mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-25 09:00:27 +00:00
WebClient: properly escape files/directories names
Fixes #981 Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
parent
3ff7acc1b4
commit
4a34ae6662
2 changed files with 10 additions and 10 deletions
|
@ -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, '&' )
|
||||
.replace( /</g, '<' )
|
||||
.replace( />/g, '>' )
|
||||
.replace( /"/g, '"' );
|
||||
};
|
||||
</script>
|
||||
|
||||
<!-- Page level plugins -->
|
||||
|
|
|
@ -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, '&' )
|
||||
.replace( /</g, '<' )
|
||||
.replace( />/g, '>' )
|
||||
.replace( /"/g, '"' );
|
||||
};
|
||||
|
||||
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+'…';
|
||||
return escapeHTML(shortened)+'…';
|
||||
}
|
||||
|
||||
function openVideoPlayer(name, url, videoType){
|
||||
|
|
Loading…
Reference in a new issue