summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/network/HTTPChunk.py2
-rw-r--r--module/network/HTTPRequest.py33
-rw-r--r--module/web/media/default/js/funktions.js2
-rw-r--r--module/web/pyload_app.py2
4 files changed, 17 insertions, 22 deletions
diff --git a/module/network/HTTPChunk.py b/module/network/HTTPChunk.py
index 0fee75682..431e5b15b 100644
--- a/module/network/HTTPChunk.py
+++ b/module/network/HTTPChunk.py
@@ -228,7 +228,7 @@ class HTTPChunk(HTTPRequest):
def parseHeader(self):
"""parse data from recieved header"""
- for orgline in self.header.splitlines():
+ for orgline in self.decodeResponse(self.header).splitlines():
line = orgline.strip().lower()
if line.startswith("accept-ranges") and "bytes" in line:
self.p.chunkSupport = True
diff --git a/module/network/HTTPRequest.py b/module/network/HTTPRequest.py
index 4dd41674c..ed320562d 100644
--- a/module/network/HTTPRequest.py
+++ b/module/network/HTTPRequest.py
@@ -205,7 +205,7 @@ class HTTPRequest():
def decodeResponse(self, rep):
""" decode with correct encoding, relies on header """
header = self.header.splitlines()
- encoding = None
+ encoding = "utf8" # default encoding
for line in header:
line = line.lower().replace(" ", "")
@@ -214,27 +214,22 @@ class HTTPRequest():
continue
none, delemiter, charset = line.rpartition("charset=")
- if not delemiter:
- encoding = "utf8"
- else:
+ if delemiter:
charset = charset.split(";")
if charset:
encoding = charset[0]
- else:
- encoding = "utf8"
-
- if encoding:
- try:
- #self.log.debug("Decoded %s" % encoding )
- decoder = getincrementaldecoder(encoding)("replace")
- rep = decoder.decode(rep, True)
-
- #TODO: html_unescape as default
-
- except LookupError:
- self.log.debug("No Decoder foung for %s" % encoding)
- except Exception:
- self.log.debug("Error when decoding string from %s." % encoding)
+
+ try:
+ #self.log.debug("Decoded %s" % encoding )
+ decoder = getincrementaldecoder(encoding)("replace")
+ rep = decoder.decode(rep, True)
+
+ #TODO: html_unescape as default
+
+ except LookupError:
+ self.log.debug("No Decoder foung for %s" % encoding)
+ except Exception:
+ self.log.debug("Error when decoding string from %s." % encoding)
return rep
diff --git a/module/web/media/default/js/funktions.js b/module/web/media/default/js/funktions.js
index 529b7056b..fe9ed699b 100644
--- a/module/web/media/default/js/funktions.js
+++ b/module/web/media/default/js/funktions.js
@@ -4,7 +4,7 @@ function humanFileSize(size) {
var loga = Math.log(size) / Math.log(1024);
var i = Math.floor(loga);
var a = Math.pow(1024, i);
- return (size == 0) ? "0 B" : (Math.round(size / a, 2) + " " + filesizename[i]);
+ return (size == 0) ? "0 B" : (Math.round(size * 100 / a) / 100 + " " + filesizename[i]);
}
function parseUri() {
diff --git a/module/web/pyload_app.py b/module/web/pyload_app.py
index 923d5d756..7492114ca 100644
--- a/module/web/pyload_app.py
+++ b/module/web/pyload_app.py
@@ -168,7 +168,7 @@ def collector():
@route("/downloads")
@login_required('download')
def downloads():
- root = PYLOAD.getConfigValue("general", "download_folder")
+ root = fs_decode(PYLOAD.getConfigValue("general", "download_folder"))
if not isdir(root):
return base([_('Download directory not found.')])