Rev1940, Fix utf8 archive names on Safari

This commit is contained in:
shortcutme 2017-02-24 14:23:44 +01:00
parent f42ad03f91
commit 819f765bce
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
2 changed files with 4 additions and 4 deletions

View file

@ -31,9 +31,9 @@ def openArchive(archive_path, path_within):
archive = archive_cache[archive_path] archive = archive_cache[archive_path]
if archive_path.endswith(".zip"): if archive_path.endswith(".zip"):
return archive.open(path_within.decode("utf8")) return archive.open(path_within)
else: else:
return archive.extractfile(path_within) return archive.extractfile(path_within.encode("utf8"))
@PluginManager.registerTo("UiRequest") @PluginManager.registerTo("UiRequest")
@ -41,7 +41,7 @@ class UiRequestPlugin(object):
def actionSiteMedia(self, path, header_length=True): def actionSiteMedia(self, path, header_length=True):
if ".zip/" in path or ".tar.gz/" in path: if ".zip/" in path or ".tar.gz/" in path:
path_parts = self.parsePath(path) path_parts = self.parsePath(path)
file_path = "%s/%s/%s" % (config.data_dir, path_parts["address"], path_parts["inner_path"]) file_path = u"%s/%s/%s" % (config.data_dir, path_parts["address"], path_parts["inner_path"].decode("utf8"))
match = re.match("^(.*\.(?:tar.gz|tar.bz2|zip))/(.*)", file_path) match = re.match("^(.*\.(?:tar.gz|tar.bz2|zip))/(.*)", file_path)
archive_path, path_within = match.groups() archive_path, path_within = match.groups()
if not os.path.isfile(archive_path): if not os.path.isfile(archive_path):

View file

@ -10,7 +10,7 @@ class Config(object):
def __init__(self, argv): def __init__(self, argv):
self.version = "0.5.2" self.version = "0.5.2"
self.rev = 1936 self.rev = 1940
self.argv = argv self.argv = argv
self.action = None self.action = None
self.config_file = "zeronet.conf" self.config_file = "zeronet.conf"