From 9c197535462c5ade79fc9aae2bfba1c57dbf1a06 Mon Sep 17 00:00:00 2001 From: KevinXuxuxu Date: Thu, 31 Jul 2025 00:07:52 -0700 Subject: [PATCH] [u2c.py] Fix unicode files argument handling for py2.7 --- bin/u2c.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/u2c.py b/bin/u2c.py index 99c426c4..85298730 100755 --- a/bin/u2c.py +++ b/bin/u2c.py @@ -52,6 +52,7 @@ if PY2: sys.dont_write_bytecode = True bytes = str + files_decoder = lambda s: unicode(s, 'utf8') else: from urllib.parse import quote_from_bytes as quote from urllib.parse import unquote_to_bytes as unquote @@ -61,6 +62,7 @@ else: from queue import Queue unicode = str + files_decoder = unicode WTF8 = "replace" if PY2 else "surrogateescape" @@ -1532,7 +1534,7 @@ source file/folder selection uses rsync syntax, meaning that: """) ap.add_argument("url", type=unicode, help="server url, including destination folder") - ap.add_argument("files", type=unicode, nargs="+", help="files and/or folders to process") + ap.add_argument("files", type=files_decoder, nargs="+", help="files and/or folders to process") ap.add_argument("-v", action="store_true", help="verbose") ap.add_argument("-a", metavar="PASSWD", help="password or $filepath") ap.add_argument("-s", action="store_true", help="file-search (disables upload)")