WebClient: properly escape files/directories names

Fixes #981

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino 2022-09-12 12:14:40 +02:00
parent 3ff7acc1b4
commit 4a34ae6662
No known key found for this signature in database
GPG key ID: 2F1FB59433D5A8CB
2 changed files with 10 additions and 10 deletions

View file

@ -228,6 +228,14 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
function replaceSlash(str){
return str.replace(/\//g,'\u2215');
}
var escapeHTML = function ( t ) {
return t
.replace( /&/g, '&amp;' )
.replace( /</g, '&lt;' )
.replace( />/g, '&gt;' )
.replace( /"/g, '&quot;' );
};
</script>
<!-- Page level plugins -->

View file

@ -433,25 +433,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
var player;
var playerKeepAlive;
var escapeHTML = function ( t ) {
return t
.replace( /&/g, '&amp;' )
.replace( /</g, '&lt;' )
.replace( />/g, '&gt;' )
.replace( /"/g, '&quot;' );
};
function shortenData(d, cutoff) {
if ( typeof d !== 'string' ) {
return d;
}
if ( d.length <= cutoff ) {
return d;
return escapeHTML(d);
}
var shortened = d.substr(0, cutoff-1);
return shortened+'&#8230;';
return escapeHTML(shortened)+'&#8230;';
}
function openVideoPlayer(name, url, videoType){