Ticket #182: escape urls.patch
File escape urls.patch, 2.7 KB (added by , 17 years ago) |
---|
-
frmresourceslist.html
23 23 --> 24 24 <html xmlns="http://www.w3.org/1999/xhtml"> 25 25 <head> 26 <title>List of resources</title> 26 27 <link href="browser.css" type="text/css" rel="stylesheet" /> 27 28 <script type="text/javascript" src="js/common.js"></script> 28 29 <script type="text/javascript"> … … 34 35 document.body.innerHTML = '' ; 35 36 } 36 37 38 function ProtectPath(path) 39 { 40 path = path.replace( /\\/g, '\\\\') ; 41 path = path.replace( /'/g, '\\\'') ; 42 return path ; 43 } 44 37 45 oListManager.GetFolderRowHtml = function( folderName, folderPath ) 38 46 { 39 47 // 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;">' ; 41 49 42 50 return '<tr>' + 43 51 '<td width="16">' + 44 52 sLink + 45 '<img alt="" src="images/Folder.gif" width="16" height="16" border="0">< /a>' +46 '< /td><td nowrap colspan="2"> ' +53 '<img alt="" src="images/Folder.gif" width="16" height="16" border="0"><\/a>' + 54 '<\/td><td nowrap colspan="2"> ' + 47 55 sLink + 48 56 folderName + 49 '< /a>' +50 '< /td></tr>' ;57 '<\/a>' + 58 '<\/td><\/tr>' ; 51 59 } 52 60 53 61 oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize ) 54 62 { 55 63 // 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;">' ; 57 65 58 66 // Get the file icon. 59 67 var sIcon = oIcons.GetIcon( fileName ) ; … … 61 69 return '<tr>' + 62 70 '<td width="16">' + 63 71 sLink + 64 '<img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0">< /a>' +65 '< /td><td> ' +72 '<img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0"><\/a>' + 73 '<\/td><td> ' + 66 74 sLink + 67 75 fileName + 68 '< /a>' +69 '< /td><td align="right" nowrap> ' +76 '<\/a>' + 77 '<\/td><td align="right" nowrap> ' + 70 78 fileSize + 71 79 ' KB' + 72 '< /td></tr>' ;80 '<\/td><\/tr>' ; 73 81 } 74 82 75 83 function OpenFolder( folderPath ) … … 80 88 81 89 function OpenFile( fileUrl ) 82 90 { 83 window.top.opener.SetUrl( fileUrl) ;91 window.top.opener.SetUrl( escape(fileUrl) ) ; 84 92 window.top.close() ; 85 93 window.top.opener.focus() ; 86 94 } … … 155 163 } 156 164 </script> 157 165 </head> 158 <body class="FileArea" bottommargin="10" leftmargin="10" topmargin="10" rightmargin="10">166 <body class="FileArea"> 159 167 </body> 160 168 </html>