Skip to content

Commit

Permalink
Item9916: replaced escape/unescape with utf8-safe encodeURI/decodeURI
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/TopicInteractionPlugin@12782 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed Oct 18, 2011
1 parent 81abcac commit e0d9bc1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
Expand Up @@ -240,18 +240,18 @@

if (uploader.features.multipart && uploader.settings.multipart) {
uploader.settings.multipart_params = {
"topic": escape(foswiki.getPreference("WEB")) + "." + escape(foswiki.getPreference("TOPIC")),
"topic": encodeURI(foswiki.getPreference("WEB")) + "." + encodeURI(foswiki.getPreference("TOPIC")),
"id": Date.now(),
"filecomment": escape(comment),
"filecomment": encodeURI(comment),
"createlink": (createlink?"on":"off"),
"hidefile": (hidefile?"on":"off")
};
} else {
var now = new Date();
uploader.settings.url = settings.url + "?"
+ "topic=" + escape(foswiki.getPreference("WEB")) + "." + escape(foswiki.getPreference("TOPIC")) + "&"
+ "topic=" + encodeURI(foswiki.getPreference("WEB")) + "." + encodeURI(foswiki.getPreference("TOPIC")) + "&"
+ "id=" + now.getTime()
+ "&filecomment=" + escape(comment)
+ "&filecomment=" + encodeURI(comment)
+ "&createlink=" + (createlink?"on":"off")
+ "&hidefile=" + (hidefile?"on":"off");
}
Expand Down
26 changes: 13 additions & 13 deletions pub/System/TopicInteractionPlugin/metadata.uncompressed.js
Expand Up @@ -76,11 +76,11 @@ jQuery(function($) {
thisUrl += ";attachments_reverse=" + opts.reverse;
}
if (typeof(opts.filter) !== 'undefined' && opts.filter != '') {
thisUrl += ";attachments_filter="+escape(opts.filter);
thisUrl += ";attachments_filter="+encodeURI(opts.filter);
}
if (typeof(opts.selection) !== 'undefined') {
for (var i = 0; i < opts.selection.length; i++) {
thisUrl += ";attachments_selection="+escape(opts.selection[i].replace(/\\\./, '.'));
thisUrl += ";attachments_selection="+encodeURI(opts.selection[i].replace(/\\\./, '.'));
}
}
if (typeof(opts.limit) !== 'undefined') {
Expand Down Expand Up @@ -448,7 +448,7 @@ jQuery(function($) {

loadDialog("#foswikiAttachmentPreviewer", "attachments::previewer");
$previewer = $("#foswikiAttachmentPreviewer"),
$previewer.find(".foswikiAttachmentName").text(unescape(attachmentOpts.filename));
$previewer.find(".foswikiAttachmentName").text(decodeURI(attachmentOpts.filename));
$previewer.find(".foswikiPreviewContainer").load(previewUrl, function() {
setTimeout(function() {
$.unblockUI();
Expand Down Expand Up @@ -484,9 +484,9 @@ jQuery(function($) {
$hideFile = $container.find("input[name=hidefile]");

$.log("METADATA: show attachment editor");
$container.find("input[name=origfilename]").val(unescape(attachmentOpts.filename));
$container.find("input[name=filename]").val(unescape(attachmentOpts.filename));
$container.find("input[name=filecomment]").val(unescape(attachmentOpts.filecomment));
$container.find("input[name=origfilename]").val(decodeURI(attachmentOpts.filename));
$container.find("input[name=filename]").val(decodeURI(attachmentOpts.filename));
$container.find("input[name=filecomment]").val(decodeURI(attachmentOpts.filecomment));
$container.find(".foswikiThumbnailContainer").empty();

$container.find(".foswikiThumbnailContainer").append(thumbnail);
Expand Down Expand Up @@ -517,7 +517,7 @@ jQuery(function($) {
} else {
val = $this.val();
}
params.push(key+"="+escape(val));
params.push(key+"="+encodeURI(val));
});
params.push("id=save");

Expand Down Expand Up @@ -567,12 +567,12 @@ jQuery(function($) {
width:300
},
onShow: function(dialog) {
dialog.container.find("#deleteAttachment").text(attachmentOpts.filename);
dialog.container.find("#deleteAttachment").text(decodeURI(attachmentOpts.filename));
dialog.container.find(".foswikiThumbnailContainer").append(thumbnail);
},
onSubmit: function(dialog) {
$.blockUI({
message:"<h1>Deleting "+attachmentOpts.filename+" ...</h1>",
message:"<h1>Deleting "+decodeURI(attachmentOpts.filename)+" ...</h1>",
fadeIn: 0,
fadeOut: 0
});
Expand Down Expand Up @@ -616,7 +616,7 @@ jQuery(function($) {

$container.find(".foswikiMoveOne").show();
$container.find(".foswikiMoveMultiple").hide();
$container.find("input[name=filename]").val(unescape(attachmentOpts.filename));
$container.find("input[name=filename]").val(decodeURI(attachmentOpts.filename));
$container.find(".foswikiThumbnailContainer").append(thumbnail);
},
onSubmit: function(dialog) {
Expand All @@ -628,7 +628,7 @@ jQuery(function($) {
$form.find("input").each(function() {
var $this = $(this), key = $this.attr('name'), val;
val = $this.val();
params.push(key+"="+escape(val));
params.push(key+"="+encodeURI(val));
});
params.push("id=move");

Expand Down Expand Up @@ -679,7 +679,7 @@ jQuery(function($) {

$select.val("");

filenames = escape(opts.selection.join(","));
filenames = encodeURI(opts.selection.join(","));
bulkActionUrl += ";filename="+filenames;
$.log("METADATA: bulkActionUrl="+bulkActionUrl);

Expand Down Expand Up @@ -785,7 +785,7 @@ jQuery(function($) {
$form.find("input").each(function() {
var $this = $(this), key = $this.attr('name'), val;
val = $this.val();
params.push(key+"="+escape(val));
params.push(key+"="+encodeURI(val));
});
params.push("id=move");

Expand Down

0 comments on commit e0d9bc1

Please sign in to comment.