Skip to content

Commit

Permalink
fix: App not build if app name contains single quotes (#279)
Browse files Browse the repository at this point in the history
- In our Android app, we save the app_name in an XML file. However, Android XML resource files do not support single quotes.
- In this commit, we sanitize the `app_name` in before generating the `config.json` file
  • Loading branch information
PruthiviRaj27 authored Dec 28, 2023
1 parent 83e73d4 commit 4bca4e8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fastlane/actions/modify_config_json_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ def self.replace_fields_value(fields, data)
app_config_json = JSON.parse(data)
config_json.each do |key, value|
if app_config_json.key?(key) && fields.include?(key)
config_json[key] = app_config_json[key]
if key == "app_name"
temp_app_name = app_config_json[key]
# Replace single quotes with escaped single quotes
config_json[key] = temp_app_name.gsub("\'", "\\\\'")
else
config_json[key] = app_config_json[key]
end
end
end
File.open(path,"w") do |f|
Expand Down

0 comments on commit 4bca4e8

Please sign in to comment.