Bug 9113: fix handling of certain characters by item batch modification tool

If you're using the batch modification tool and entering a call number
like "E+ 123 ABC", the tool removes the + and puts a space in its place,
e.g., "E  123 ABC"

This is because the form is posted via Ajax by background-job-progressbar.js.
Values are URI-encoded using escape(), but this method does not escape some
characters: * @ - _ + . /

Also, "+" is considered as a space in a URI.

This patch replaces escape() by encodeURIComponent() which encodes every character.

Test plan :
Perform an items batch modification by setting '* @ - _ + . /' in a field
(notes for example) and see that all characters are saved correctly.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 0397e7ea64)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
(cherry picked from commit dbd52acf29)
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
(cherry picked from commit dbd52acf29)
Signed-off-by: Chris Hall <followingthepath@gmail.com>
(cherry picked from commit 70cc750a5f)
This commit is contained in:
Fridolyn SOMERS 2013-06-26 17:52:40 +02:00 committed by Chris Hall
parent 869de32358
commit d4f7db74cd
1 changed files with 2 additions and 2 deletions

View File

@ -45,12 +45,12 @@ function submitBackgroundJob(f) {
$(':input', f).each(function() {
if (this.type == 'radio' || this.type == 'checkbox') {
if (this.checked) {
inputs.push(this.name + '=' + escape(this.value));
inputs.push(this.name + '=' + encodeURIComponent(this.value));
}
} else if (this.type == 'button') {
; // do nothing
} else {
inputs.push(this.name + '=' + escape(this.value));
inputs.push(this.name + '=' + encodeURIComponent(this.value));
}
});