diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index d50fb036..82d3e1fc 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -627,12 +627,9 @@ class HttpCli(object): if self.vpath.endswith(k): self.vpath = self.vpath[: -len(k)] - sub = None name = undot(body["name"]) if "/" in name: - sub, name = name.rsplit("/", 1) - self.vpath = "/".join([self.vpath, sub]).strip("/") - body["name"] = name + raise Pebkac(400, "your client is old; press CTRL-SHIFT-R and try again") vfs, rem = self.asrv.vfs.get(self.vpath, self.uname, False, True) dbv, vrem = vfs.get_dbv(rem) @@ -643,7 +640,7 @@ class HttpCli(object): body["addr"] = self.ip body["vcfg"] = dbv.flags - if sub: + if rem: try: dst = os.path.join(vfs.realpath, rem) if not bos.path.isdir(dst): @@ -663,9 +660,6 @@ class HttpCli(object): x = self.conn.hsrv.broker.put(True, "up2k.handle_json", body) ret = x.get() - if sub: - ret["name"] = "/".join([sub, ret["name"]]) - ret = json.dumps(ret) self.log(ret) self.reply(ret.encode("utf-8"), mime="application/json") diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index e2121a4d..3410ca9b 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -814,17 +814,25 @@ function up2k_init(subtle) { for (var a = 0; a < good_files.length; a++) { var fobj = good_files[a][0], + name = good_files[a][1], + fdir = '', now = Date.now(), - lmod = fobj.lastModified || now; + lmod = fobj.lastModified || now, + ofs = name.lastIndexOf('/') + 1; + + if (ofs) { + fdir = name.slice(0, ofs); + name = name.slice(ofs); + } var entry = { "n": st.files.length, "t0": now, "fobj": fobj, - "name": good_files[a][1], + "name": name, "size": fobj.size, "lmod": lmod / 1000, - "purl": evpath, + "purl": fdir, "done": false, "hash": [] },