Fix running Shortcuts with spaces in the name
@@ -4,15 +4,7 @@ Taken from https://stackoverflow.com/a/25580545/7515957
from json import dumps
-try:
- from urllib import urlencode, unquote
- from urlparse import urlparse, parse_qsl, ParseResult
-except ImportError:
- # Python 3 fallback
- from urllib.parse import (
- urlencode, unquote, urlparse, parse_qsl, ParseResult
- )
-
+from urllib.parse import (urlencode, unquote, quote, urlparse, parse_qsl, ParseResult)
def add_url_params(url, params):
""" Add GET params to provided URL being aware of existing.
@@ -45,7 +37,7 @@ def add_url_params(url, params):
)
# Converting URL argument to proper query string
- encoded_get_args = urlencode(parsed_get_args, doseq=False)
+ encoded_get_args = urlencode(parsed_get_args, doseq=True, quote_via=quote)
# Creating new parsed result object based on provided with new
# URL arguments. Same thing happens inside of urlparse.
new_url = ParseResult(
@@ -53,4 +45,5 @@ def add_url_params(url, params):
parsed_url.params, encoded_get_args, parsed_url.fragment
).geturl()
+ print(new_url)
return new_url
