other minor html-escaping fixes

mostly related to error-handling for uploads, network-loss etc,
nothing worse than the dom-xss just now
This commit is contained in:
ed 2025-02-24 22:42:05 +00:00
parent 438ea6ccb0
commit 499ae1c7a1
2 changed files with 7 additions and 7 deletions

View file

@ -2073,8 +2073,8 @@ function up2k_init(subtle) {
try { orz(e); } catch (ex) { vis_exh(ex + '', 'up2k.js', '', '', ex); } try { orz(e); } catch (ex) { vis_exh(ex + '', 'up2k.js', '', '', ex); }
}; };
reader.onerror = function () { reader.onerror = function () {
var err = reader.error + ''; var err = esc('' + reader.error),
var handled = false; handled = false;
if (err.indexOf('NotReadableError') !== -1 || // win10-chrome defender if (err.indexOf('NotReadableError') !== -1 || // win10-chrome defender
err.indexOf('NotFoundError') !== -1 // macos-firefox permissions err.indexOf('NotFoundError') !== -1 // macos-firefox permissions
@ -2298,7 +2298,7 @@ function up2k_init(subtle) {
xhr.onerror = xhr.ontimeout = function () { xhr.onerror = xhr.ontimeout = function () {
console.log('head onerror, retrying', t.name, t); console.log('head onerror, retrying', t.name, t);
if (!toast.visible) if (!toast.visible)
toast.warn(9.98, L.u_enethd + "\n\nfile: " + t.name, t); toast.warn(9.98, L.u_enethd + "\n\nfile: " + esc(t.name), t);
apop(st.busy.head, t); apop(st.busy.head, t);
st.todo.head.unshift(t); st.todo.head.unshift(t);
@ -2373,7 +2373,7 @@ function up2k_init(subtle) {
return console.log('zombie handshake onerror', t.name, t); return console.log('zombie handshake onerror', t.name, t);
if (!toast.visible) if (!toast.visible)
toast.warn(9.98, L.u_eneths + "\n\nfile: " + t.name, t); toast.warn(9.98, L.u_eneths + "\n\nfile: " + esc(t.name), t);
console.log('handshake onerror, retrying', t.name, t); console.log('handshake onerror, retrying', t.name, t);
apop(st.busy.handshake, t); apop(st.busy.handshake, t);
@ -2478,7 +2478,7 @@ function up2k_init(subtle) {
var idx = t.hash.indexOf(missing[a]); var idx = t.hash.indexOf(missing[a]);
if (idx < 0) if (idx < 0)
return modal.alert('wtf negative index for hash "{0}" in task:\n{1}'.format( return modal.alert('wtf negative index for hash "{0}" in task:\n{1}'.format(
missing[a], JSON.stringify(t))); missing[a], esc(JSON.stringify(t))));
t.postlist.push(idx); t.postlist.push(idx);
cbd[idx] = 0; cbd[idx] = 0;
@ -2833,7 +2833,7 @@ function up2k_init(subtle) {
xhr.bsent = 0; xhr.bsent = 0;
if (!toast.visible) if (!toast.visible)
toast.warn(9.98, L.u_cuerr.format(snpart, Math.ceil(t.size / chunksize), t.name), t); toast.warn(9.98, L.u_cuerr.format(snpart, Math.ceil(t.size / chunksize), esc(t.name)), t);
t.nojoin = t.nojoin || t.postlist.length; // maybe rproxy postsize limit t.nojoin = t.nojoin || t.postlist.length; // maybe rproxy postsize limit
console.log('chunkpit onerror,', t.name, t); console.log('chunkpit onerror,', t.name, t);

View file

@ -64,7 +64,7 @@ onmessage = (d) => {
}; };
reader.onerror = function () { reader.onerror = function () {
busy = false; busy = false;
var err = reader.error + ''; var err = esc('' + reader.error);
if (err.indexOf('NotReadableError') !== -1 || // win10-chrome defender if (err.indexOf('NotReadableError') !== -1 || // win10-chrome defender
err.indexOf('NotFoundError') !== -1 // macos-firefox permissions err.indexOf('NotFoundError') !== -1 // macos-firefox permissions