mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
fix paths in rootdir + js unescape
This commit is contained in:
parent
a95b627a7e
commit
f5e07fcfbc
|
@ -132,7 +132,6 @@ class HttpCli(object):
|
||||||
self.reply(b"<pre>" + body.encode("utf-8"), *list(args), **kwargs)
|
self.reply(b"<pre>" + body.encode("utf-8"), *list(args), **kwargs)
|
||||||
|
|
||||||
def handle_get(self):
|
def handle_get(self):
|
||||||
self.log("")
|
|
||||||
self.log("GET " + self.req)
|
self.log("GET " + self.req)
|
||||||
|
|
||||||
# "embedded" resources
|
# "embedded" resources
|
||||||
|
@ -172,7 +171,6 @@ class HttpCli(object):
|
||||||
return self.tx_upper()
|
return self.tx_upper()
|
||||||
|
|
||||||
def handle_post(self):
|
def handle_post(self):
|
||||||
self.log("")
|
|
||||||
self.log("POST " + self.req)
|
self.log("POST " + self.req)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -222,8 +220,11 @@ class HttpCli(object):
|
||||||
files = []
|
files = []
|
||||||
t0 = time.time()
|
t0 = time.time()
|
||||||
for nfile, (p_field, p_file, p_data) in enumerate(self.parser.gen):
|
for nfile, (p_field, p_file, p_data) in enumerate(self.parser.gen):
|
||||||
|
if not p_file:
|
||||||
|
self.log("discarding incoming file without filename")
|
||||||
|
|
||||||
fn = os.devnull
|
fn = os.devnull
|
||||||
if not nullwrite:
|
if p_file and not nullwrite:
|
||||||
fn = os.path.join(vfs.realpath, rem, sanitize_fn(p_file))
|
fn = os.path.join(vfs.realpath, rem, sanitize_fn(p_file))
|
||||||
|
|
||||||
# TODO broker which avoid this race
|
# TODO broker which avoid this race
|
||||||
|
@ -239,6 +240,8 @@ class HttpCli(object):
|
||||||
|
|
||||||
files.append([sz, sha512])
|
files.append([sz, sha512])
|
||||||
|
|
||||||
|
self.parser.drop()
|
||||||
|
|
||||||
td = time.time() - t0
|
td = time.time() - t0
|
||||||
sz_total = sum(x[0] for x in files)
|
sz_total = sum(x[0] for x in files)
|
||||||
spd = (sz_total / td) / (1024 * 1024)
|
spd = (sz_total / td) / (1024 * 1024)
|
||||||
|
@ -256,7 +259,7 @@ class HttpCli(object):
|
||||||
|
|
||||||
html = self.conn.tpl_msg.render(
|
html = self.conn.tpl_msg.render(
|
||||||
h2='<a href="/{}">return to /{}</a>'.format(
|
h2='<a href="/{}">return to /{}</a>'.format(
|
||||||
quote_plus(self.vpath, safe="/"), cgi.escape(self.vpath, quote=True)
|
quotep(self.vpath), cgi.escape(self.vpath, quote=True)
|
||||||
),
|
),
|
||||||
pre=msg,
|
pre=msg,
|
||||||
)
|
)
|
||||||
|
@ -317,7 +320,11 @@ class HttpCli(object):
|
||||||
vpath = ""
|
vpath = ""
|
||||||
vpnodes = [["/", "/"]]
|
vpnodes = [["/", "/"]]
|
||||||
for node in self.vpath.split("/"):
|
for node in self.vpath.split("/"):
|
||||||
vpath += "/" + node
|
if not vpath:
|
||||||
|
vpath = node
|
||||||
|
else:
|
||||||
|
vpath += "/" + node
|
||||||
|
|
||||||
vpnodes.append([quotep(vpath) + "/", cgi.escape(node)])
|
vpnodes.append([quotep(vpath) + "/", cgi.escape(node)])
|
||||||
|
|
||||||
vn, rem = self.auth.vfs.get(self.vpath, self.uname, True, False)
|
vn, rem = self.auth.vfs.get(self.vpath, self.uname, True, False)
|
||||||
|
@ -362,6 +369,6 @@ class HttpCli(object):
|
||||||
|
|
||||||
dirs.extend(files)
|
dirs.extend(files)
|
||||||
html = self.conn.tpl_browser.render(
|
html = self.conn.tpl_browser.render(
|
||||||
vpnodes=vpnodes, files=dirs, can_upload=self.writable
|
vdir=self.vpath, vpnodes=vpnodes, files=dirs, can_upload=self.writable
|
||||||
)
|
)
|
||||||
self.reply(html.encode("utf-8", "replace"))
|
self.reply(html.encode("utf-8", "replace"))
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<body>
|
<body>
|
||||||
{%- if can_upload %}
|
{%- if can_upload %}
|
||||||
<div id="bup">
|
<div id="bup">
|
||||||
<form method="post" enctype="multipart/form-data" accept-charset="utf-8">
|
<form method="post" enctype="multipart/form-data" accept-charset="utf-8" action="/{{ vdir }}">
|
||||||
<input type="hidden" name="act" value="bput" />
|
<input type="hidden" name="act" value="bput" />
|
||||||
<input type="file" name="f" multiple><br />
|
<input type="file" name="f" multiple><br />
|
||||||
<input type="submit" value="start upload">
|
<input type="submit" value="start upload">
|
||||||
|
|
|
@ -571,7 +571,10 @@ function autoplay_blocked(tid) {
|
||||||
var go = ebi('blk_go');
|
var go = ebi('blk_go');
|
||||||
var na = ebi('blk_na');
|
var na = ebi('blk_na');
|
||||||
|
|
||||||
go.textContent = 'Play "' + mp.tracks[mp.au.tid].split(/\//).pop() + '"';
|
var fn = mp.tracks[mp.au.tid].split(/\//).pop();
|
||||||
|
fn = decodeURIComponent(fn.replace(/\+/g, ' '));
|
||||||
|
|
||||||
|
go.textContent = 'Play "' + fn + '"';
|
||||||
go.onclick = function () {
|
go.onclick = function () {
|
||||||
unblocked();
|
unblocked();
|
||||||
mp.au.play();
|
mp.au.play();
|
||||||
|
|
Loading…
Reference in a new issue