From 3651593a5e7cfae967badf0b0f11527e0ca56d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Pradel?= Date: Tue, 13 Oct 2020 23:16:22 +0200 Subject: [PATCH] fix: escape keystore_info params passed to bundletool Hi, I tried to use your action but I am currently facing some problems, I keep getting the following error ```sh [20:59:20]: Bundletool could not extract universal apk from aab at /home/runner/work/***/***/android/app/build/outputs/bundle/release/app-release.aab. Error message sh: 1: stGAXs: not found [BT:0.11.0] Error: Incorrect keystore password. com.android.tools.build.bundletool.model.exceptions.CommandExecutionException: Incorrect keystore password. at com.android.tools.build.bundletool.model.SigningConfiguration.extractFromKeystore(SigningConfiguration.java:116) at com.android.tools.build.bundletool.commands.BuildApksCommand.fromFlags(BuildApksCommand.java:457) at com.android.tools.build.bundletool.commands.BuildApksCommand.fromFlags(BuildApksCommand.java:417) at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:74) at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:46) ``` After a bit of debugging it looks like the parameters passed down to bundle tools are not escaped, with this simple fix we should now be able to use special chars as a password. Let me know if something is missing in this pr, thanks for this nice plugin! --- lib/fastlane/plugin/bundletool/actions/bundletool_action.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fastlane/plugin/bundletool/actions/bundletool_action.rb b/lib/fastlane/plugin/bundletool/actions/bundletool_action.rb index f046c98..aae2344 100644 --- a/lib/fastlane/plugin/bundletool/actions/bundletool_action.rb +++ b/lib/fastlane/plugin/bundletool/actions/bundletool_action.rb @@ -71,7 +71,7 @@ def self.run_bundletool!(aab_path, keystore_info) keystore_params = '' unless keystore_info.empty? - keystore_params = "--ks=\"#{keystore_info[:keystore_path]}\" --ks-pass=pass:#{keystore_info[:keystore_password]} --ks-key-alias=#{keystore_info[:alias]} --key-pass=pass:#{keystore_info[:alias_password]}" + keystore_params = "--ks=\"#{keystore_info[:keystore_path]}\" --ks-pass=\"pass:#{keystore_info[:keystore_password]}\" --ks-key-alias=\"#{keystore_info[:alias]}\" --key-pass=\"pass:#{keystore_info[:alias_password]}\"" end cmd = "java -jar #{@bundletool_temp_path}/bundletool.jar build-apks --bundle=\"#{aab_path}\" --output=\"#{output_path}\" --mode=universal #{keystore_params}"