Ticket #182: escape urls.patch

File escape urls.patch, 2.7 kB (added by alfonsoml, 16 months ago)

work in progress

  • frmresourceslist.html

     
    2323--> 
    2424<html xmlns="http://www.w3.org/1999/xhtml"> 
    2525<head> 
     26        <title>List of resources</title> 
    2627        <link href="browser.css" type="text/css" rel="stylesheet" /> 
    2728        <script type="text/javascript" src="js/common.js"></script> 
    2829        <script type="text/javascript"> 
     
    3435        document.body.innerHTML = '' ; 
    3536} 
    3637 
     38function ProtectPath(path) 
     39{ 
     40        path = path.replace( /\\/g, '\\\\') ; 
     41        path = path.replace( /'/g, '\\\'') ; 
     42        return path ; 
     43} 
     44 
    3745oListManager.GetFolderRowHtml = function( folderName, folderPath ) 
    3846{ 
    3947        // Build the link to view the folder. 
    40         var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath.replace( /'/g, '\\\'') + '\');return false;">' ; 
     48        var sLink = '<a href="#" onclick="OpenFolder(\'' + ProtectPath(folderPath) + '\');return false;">' ; 
    4149 
    4250        return '<tr>' + 
    4351                        '<td width="16">' + 
    4452                                sLink + 
    45                                 '<img alt="" src="images/Folder.gif" width="16" height="16" border="0"></a>' + 
    46                         '</td><td nowrap colspan="2">&nbsp;' + 
     53                                '<img alt="" src="images/Folder.gif" width="16" height="16" border="0"><\/a>' + 
     54                        '<\/td><td nowrap colspan="2">&nbsp;' + 
    4755                                sLink + 
    4856                                folderName + 
    49                                 '</a>' + 
    50                 '</td></tr>' ; 
     57                                '<\/a>' + 
     58                '<\/td><\/tr>' ; 
    5159} 
    5260 
    5361oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize ) 
    5462{ 
    5563        // Build the link to view the folder. 
    56         var sLink = '<a href="#" onclick="OpenFile(\'' + fileUrl.replace( /'/g, '\\\'') + '\');return false;">' ; 
     64        var sLink = '<a href="#" onclick="OpenFile(\'' + ProtectPath(fileUrl) + '\');return false;">' ; 
    5765 
    5866        // Get the file icon. 
    5967        var sIcon = oIcons.GetIcon( fileName ) ; 
     
    6169        return '<tr>' + 
    6270                        '<td width="16">' + 
    6371                                sLink + 
    64                                 '<img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0"></a>' + 
    65                         '</td><td>&nbsp;' + 
     72                                '<img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0"><\/a>' + 
     73                        '<\/td><td>&nbsp;' + 
    6674                                sLink + 
    6775                                fileName + 
    68                                 '</a>' + 
    69                         '</td><td align="right" nowrap>&nbsp;' + 
     76                                '<\/a>' + 
     77                        '<\/td><td align="right" nowrap>&nbsp;' + 
    7078                                fileSize + 
    7179                                ' KB' + 
    72                 '</td></tr>' ; 
     80                '<\/td><\/tr>' ; 
    7381} 
    7482 
    7583function OpenFolder( folderPath ) 
     
    8088 
    8189function OpenFile( fileUrl ) 
    8290{ 
    83         window.top.opener.SetUrl( fileUrl ) ; 
     91        window.top.opener.SetUrl( escape(fileUrl) ) ; 
    8492        window.top.close() ; 
    8593        window.top.opener.focus() ; 
    8694} 
     
    155163} 
    156164        </script> 
    157165</head> 
    158 <body class="FileArea" bottommargin="10" leftmargin="10" topmargin="10" rightmargin="10"> 
     166<body class="FileArea"> 
    159167</body> 
    160168</html>