mirror of
https://github.com/9001/copyparty.git
synced 2026-11-24 19:02:36 +00:00
don't embed huge docs (defer to ajax), closes #9
This commit is contained in:
1 parent
c110ccb9ae
commit
67c298e66b
3 files changed
+19
-4
No files matched your search
@@ -2438,14 +2438,19 @@ class HttpCli(object):
|
||||
if doc:
|
||||
doc = unquotep(doc.replace("+", " ").split("?")[0])
|
||||
j2a["docname"] = doc
|
||||
doctxt = None
|
||||
if next((x for x in files if x["name"] == doc), None):
|
||||
with open(os.path.join(abspath, doc), "rb") as f:
|
||||
doc = f.read().decode("utf-8", "replace")
|
||||
docpath = os.path.join(abspath, doc)
|
||||
sz = bos.path.getsize(docpath)
|
||||
if sz < 1024 * self.args.txt_max:
|
||||
with open(docpath, "rb") as f:
|
||||
doctxt = f.read().decode("utf-8", "replace")
|
||||
else:
|
||||
self.log("doc 404: [{}]".format(doc), c=6)
|
||||
doc = "( textfile not found )"
|
||||
doctxt = "( textfile not found )"
|
||||
|
||||
j2a["doc"] = doc
|
||||
if doctxt is not None:
|
||||
j2a["doc"] = doctxt
|
||||
|
||||
if not self.conn.hsrv.prism:
|
||||
j2a["no_prism"] = True
|
||||
|
||||
Reference in new issue
Block a user