mirror of
				https://github.com/9001/copyparty.git
				synced 2025-11-04 05:43:17 +00:00 
			
		
		
		
	improve up2k error messages
This commit is contained in:
		@@ -284,10 +284,11 @@ class HttpCli(object):
 | 
				
			|||||||
                msg = str(ex) if pex == ex else min_ex()
 | 
					                msg = str(ex) if pex == ex else min_ex()
 | 
				
			||||||
                self.log("{}\033[0m, {}".format(msg, self.vpath), 3)
 | 
					                self.log("{}\033[0m, {}".format(msg, self.vpath), 3)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                msg = "<pre>{}\r\nURL: {}\r\n".format(str(ex), self.vpath)
 | 
					                msg = "{}\r\nURL: {}\r\n".format(str(ex), self.vpath)
 | 
				
			||||||
                if self.hint:
 | 
					                if self.hint:
 | 
				
			||||||
                    msg += "hint: {}\r\n".format(self.hint)
 | 
					                    msg += "hint: {}\r\n".format(self.hint)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                msg = "<pre>" + html_escape(msg)
 | 
				
			||||||
                self.reply(msg.encode("utf-8", "replace"), status=pex.code, volsan=True)
 | 
					                self.reply(msg.encode("utf-8", "replace"), status=pex.code, volsan=True)
 | 
				
			||||||
                return self.keepalive
 | 
					                return self.keepalive
 | 
				
			||||||
            except Pebkac:
 | 
					            except Pebkac:
 | 
				
			||||||
@@ -1879,7 +1880,7 @@ class HttpCli(object):
 | 
				
			|||||||
        if self.args.no_stack:
 | 
					        if self.args.no_stack:
 | 
				
			||||||
            raise Pebkac(403, "the stackdump feature is disabled in server config")
 | 
					            raise Pebkac(403, "the stackdump feature is disabled in server config")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ret = "<pre>{}\n{}".format(time.time(), alltrace())
 | 
					        ret = "<pre>{}\n{}".format(time.time(), html_escape(alltrace()))
 | 
				
			||||||
        self.reply(ret.encode("utf-8"))
 | 
					        self.reply(ret.encode("utf-8"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def tx_tree(self):
 | 
					    def tx_tree(self):
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1811,11 +1811,8 @@ function up2k_init(subtle) {
 | 
				
			|||||||
                    tasker();
 | 
					                    tasker();
 | 
				
			||||||
                    return;
 | 
					                    return;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                toast.err(0, "server broke; hs-err {0} on file [{1}]:\n".format(
 | 
					                err = t.t_uploading ? "finalize upload" : t.srch ? "perform search" : "initiate upload";
 | 
				
			||||||
                    xhr.status, t.name) + (
 | 
					                xhrchk(xhr, "server rejected the request to " + err + ";\n\nfile: " + t.name + "\n\nerror ", "404, target folder not found");
 | 
				
			||||||
                        (xhr.response && xhr.response.err) ||
 | 
					 | 
				
			||||||
                        (xhr.responseText && xhr.responseText) ||
 | 
					 | 
				
			||||||
                        "no further information"));
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        xhr.onload = function (e) {
 | 
					        xhr.onload = function (e) {
 | 
				
			||||||
@@ -1874,8 +1871,7 @@ function up2k_init(subtle) {
 | 
				
			|||||||
                console.log("ignoring dupe-segment error", t);
 | 
					                console.log("ignoring dupe-segment error", t);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else {
 | 
					            else {
 | 
				
			||||||
                toast.err(0, "server broke; cu-err {0} on file [{1}]:\n".format(
 | 
					                xhrchk(xhr, "server rejected upload (chunk {0} of {1});\n\nfile: {2}\n\nerror ".format(npart, Math.ceil(t.size / chunksize), t.name), "404, target folder not found (???)");
 | 
				
			||||||
                    xhr.status, t.name) + (txt || "no further information"));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                chill(t);
 | 
					                chill(t);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -1904,7 +1900,7 @@ function up2k_init(subtle) {
 | 
				
			|||||||
                    return;
 | 
					                    return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (!toast.visible)
 | 
					                if (!toast.visible)
 | 
				
			||||||
                    toast.warn(9.98, "failed to upload a chunk;\nprobably harmless, continuing\n\n" + t.name);
 | 
					                    toast.warn(9.98, "failed to upload chunk {0} of {1};\nprobably harmless, continuing\n\nfile: {2}".format(npart, Math.ceil(t.size / chunksize), t.name));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                console.log('chunkpit onerror,', ++tries, t);
 | 
					                console.log('chunkpit onerror,', ++tries, t);
 | 
				
			||||||
                orz2(xhr);
 | 
					                orz2(xhr);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1402,5 +1402,6 @@ function xhrchk(xhr, prefix, e404) {
 | 
				
			|||||||
    if (xhr.status == 404)
 | 
					    if (xhr.status == 404)
 | 
				
			||||||
        return toast.err(0, prefix + e404);
 | 
					        return toast.err(0, prefix + e404);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return toast.err(0, prefix + xhr.status + ": " + xhr.responseText);
 | 
					    return toast.err(0, prefix + xhr.status + ": " + (
 | 
				
			||||||
 | 
					        (xhr.response && xhr.response.err) || xhr.responseText));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user