22import os
33import sys
44import re
5- import pipes
5+ import shlex
66from workflow import Workflow , ICON_INFO , ICON_NOTE , ICON_ERROR , ICON_WARNING
77from toolchain import run_script
88from workflow .background import is_running , run_in_background
@@ -62,7 +62,7 @@ def showApkInstallItems():
6262
6363 arg = wf .args [0 ].strip ()
6464
65- apkPath = pipes .quote (apkFileOrFolder )
65+ apkPath = shlex .quote (apkFileOrFolder )
6666 log .debug ("Path {0}" .format (apkPath ))
6767 apk = None
6868 if not aapt_path :
@@ -72,7 +72,7 @@ def showApkInstallItems():
7272 if not apksigner_path :
7373 wf .add_item (title = "apksigner not found" , subtitle = "Please config 'apksigner_path' in workflow settings for richer APK info" , valid = False , icon = ICON_WARNING )
7474 else :
75- cmd_dump_badging = "{0} dump badging {1} | grep 'package:\|application-label:\|dkVersion:\|uses-permission:\|application-debuggable\|testOnly='" .format (aapt_path , apkPath )
75+ cmd_dump_badging = r "{0} dump badging {1} | grep 'package:\|application-label:\|dkVersion:\|uses-permission:\|application-debuggable\|testOnly='" .format (aapt_path , apkPath )
7676 cmd_list_all = "{0} list -a {1} | grep 'sharedUserId'" .format (aapt_path , apkPath )
7777 result_dump = run_script (cmd_dump_badging )
7878 is_system_app = False
@@ -138,7 +138,7 @@ def showApkInstallItems():
138138 currentVersionCode = ""
139139
140140 if serial :
141- shell_cmd = "{0} -s {1} shell dumpsys package {2} | grep 'versionCode\|versionName' | awk '{{print $1}}'" .format (adb_path , serial , apk ["packName" ])
141+ shell_cmd = r "{0} -s {1} shell dumpsys package {2} | grep 'versionCode\|versionName' | awk '{{print $1}}'" .format (adb_path , serial , apk ["packName" ])
142142
143143 try :
144144 currentApkResult = run_script (shell_cmd )
@@ -197,7 +197,7 @@ def showApkInstallItems():
197197
198198 if deviceApi and "min" in apk and int (deviceApi ) < apk ["min" ]:
199199 wf .add_item (title = "Incompatiable device" , subtitle = "current device api level is {1}, lower than apk minSdkVersion {0}, " .format (deviceApi , apk ["min" ]), icon = ICON_ERROR , valid = False )
200- if deviceApi and "max" in apk and int (deviceApi ) > apk ["maxs " ]:
200+ if deviceApi and "max" in apk and int (deviceApi ) > apk ["max " ]:
201201 wf .add_item (title = "Incompatiable device" , subtitle = "current device api level is {1}, higher than apk maxSdkVersion {0}, " .format (deviceApi , apk ["max" ]), icon = ICON_ERROR , valid = False )
202202
203203
0 commit comments