more accurate url escaping

This commit is contained in:
ed 2021-05-29 09:02:42 +02:00
parent d25881d5c3
commit c5e9a643e7
3 changed files with 15 additions and 9 deletions

View file

@ -1125,7 +1125,7 @@ document.onkeydown = function (e) {
sz = esc(r.sz + ''),
rp = esc(r.rp + ''),
ext = rp.lastIndexOf('.') > 0 ? rp.split('.').slice(-1)[0] : '%',
links = linksplit(rp);
links = linksplit(r.rp + '');
if (ext.length > 8)
ext = '%';
@ -1465,6 +1465,8 @@ var treectl = (function () {
ebi('pro').innerHTML = res.logues ? res.logues[0] || "" : "";
ebi('epi').innerHTML = res.logues ? res.logues[1] || "" : "";
document.title = '⇆🎉 ' + uricom_dec(document.location.pathname.slice(1, -1))[0];
filecols.set_style();
mukey.render();
msel.render();

View file

@ -696,7 +696,7 @@ function up2k_init(subtle) {
pvis.addfile([
fsearch ? esc(entry.name) : linksplit(
esc(uricom_dec(entry.purl)[0] + entry.name)).join(' '),
uricom_dec(entry.purl)[0] + entry.name).join(' '),
'📐 hash',
''
], fobj.size);
@ -1023,7 +1023,7 @@ function up2k_init(subtle) {
else {
smsg = 'found';
var hit = response.hits[0],
msg = linksplit(esc(hit.rp)).join(''),
msg = linksplit(hit.rp).join(''),
tr = unix2iso(hit.ts),
tu = unix2iso(t.lmod),
diff = parseInt(t.lmod) - parseInt(hit.ts),
@ -1045,7 +1045,7 @@ function up2k_init(subtle) {
if (response.name !== t.name) {
// file exists; server renamed us
t.name = response.name;
pvis.seth(t.n, 0, linksplit(esc(t.purl + t.name)).join(' '));
pvis.seth(t.n, 0, linksplit(t.purl + t.name).join(' '));
}
var chunksize = get_chunksize(t.size),

View file

@ -358,12 +358,16 @@ function linksplit(rp) {
link = rp.slice(0, ofs + 1);
rp = rp.slice(ofs + 1);
}
var vlink = link;
if (link.indexOf('/') !== -1)
vlink = link.slice(0, -1) + '<span>/</span>';
var vlink = esc(link),
elink = uricom_enc(link);
ret.push('<a href="' + apath + link + '">' + vlink + '</a>');
apath += link;
if (link.indexOf('/') !== -1) {
vlink = vlink.slice(0, -1) + '<span>/</span>';
elink = elink.slice(0, -3) + '/';
}
ret.push('<a href="' + apath + elink + '">' + vlink + '</a>');
apath += elink;
}
return ret;
}