Skip to content
Snippets Groups Projects
Commit 73aaf250 authored by Martmists's avatar Martmists
Browse files

Using `shlex.split` to properly pass all arguments

parent 6815bd53
No related branches found
No related tags found
1 merge request!6Termux dev
...@@ -11,6 +11,7 @@ import owo ...@@ -11,6 +11,7 @@ import owo
import os import os
import sys import sys
import time import time
import shlex
import subprocess import subprocess
...@@ -75,21 +76,25 @@ def main(): ...@@ -75,21 +76,25 @@ def main():
try: try:
# os.system won't raise an error # os.system won't raise an error
subprocess.run(( subprocess.run(
"termux-notification " shlex.split((
'--title "File uploaded" ' "termux-notification "
'--content "{0}" ' '--title "File uploaded" '
'--button1 "Copy link" ' '--content "{0}" '
'--button1-action "termux-clipboard-set {0}" ' '--button1 "Copy link" '
'--button2 "Share" ' '--button1-action "termux-clipboard-set {0}" '
'--button2-action "termux-share {0}" ').format(url) '--button2 "Share" '
'--button2-action "termux-share {0}" '
).format(url))
) )
print_v("Sent notification") print_v("Sent notification")
except: except FileNotFoundError:
# termux-api not installed
print("File uploaded: {}, URL: {}".format( print("File uploaded: {}, URL: {}".format(
file, url)) file, url))
else: else:
# Non-mobile devices
print("File uploaded: {}, URL: {}".format( print("File uploaded: {}, URL: {}".format(
file, url)) file, url))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment