Skip to content
Snippets Groups Projects
Commit d3ac31c2 authored by echicken's avatar echicken :chicken:
Browse files

If extended file description contains extended ascii or an escape sequence,...

If extended file description contains extended ascii or an escape sequence, run it through html_encode and put it in a pre block of the 'ansi' class, otherwise just put it in a plain pre (if it exists); people should update their exec/load/filebase.js to fix an extended-description loading bug.
parent 4c340bbf
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,13 @@ if (typeof http_request.query.dir !== 'undefined' && ...@@ -28,6 +28,13 @@ if (typeof http_request.query.dir !== 'undefined' &&
); );
function writeFileDetails(file) { function writeFileDetails(file) {
if (typeof file.extdesc === 'undefined') {
file.extdesc = '';
} else if (file.extdesc.search(/(\x1B\[|[\xA8-\xFE])/) > -1) {
file.extdesc = '<pre class="ansi">' + html_encode(file.extdesc, true, false, true, true) + '</pre>';
} else {
file.extdesc = '<pre>' + file.extdesc + '</pre>';
}
writeln( writeln(
format( format(
'<a href="./api/files.ssjs?call=download-file&amp;dir=%s&amp;file=%s" target="_blank" class="list-group-item striped">' + '<a href="./api/files.ssjs?call=download-file&amp;dir=%s&amp;file=%s" target="_blank" class="list-group-item striped">' +
...@@ -36,13 +43,8 @@ if (typeof http_request.query.dir !== 'undefined' && ...@@ -36,13 +43,8 @@ if (typeof http_request.query.dir !== 'undefined' &&
'<p>%s</p>' + '<p>%s</p>' +
'%s' + '%s' +
'</a>', '</a>',
http_request.query.dir[0], http_request.query.dir[0], file.name, file.name, file.size,
file.name, system.timestr(file.uldate), file.desc, file.extdesc
file.name,
file.size,
system.timestr(file.uldate),
file.desc,
typeof file.extdesc === 'undefined' ? "" : ("<p>" + file.extdesc + "</p>")
) )
); );
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment