Skip to content

Commit 3bbc879

Browse files
Do not decode + to a space - fixes #3
1 parent a0eea46 commit 3bbc879

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ module.exports = function (encodedURI) {
8383
}
8484

8585
try {
86-
encodedURI = encodedURI.replace(/\+/g, ' ');
87-
8886
// Try the built in decoder first
8987
return decodeURIComponent(encodedURI);
9088
} catch (err) {

readme.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
## Why?
99

10-
- Decodes `+` to a space.
1110
- Converts the [BOM](https://en.wikipedia.org/wiki/Byte_order_mark) to a [replacement character](https://en.wikipedia.org/wiki/Specials_(Unicode_block)#Replacement_character) ``.
1211
- Does not throw with invalid encoded input.
1312
- Decodes as much of the string as possible.

test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import m from './';
33

44
const tests = {
55
'test': 'test',
6-
'a+b': 'a b',
7-
'a+b+c+d': 'a b c d',
6+
'a+b': 'a+b',
7+
'a+b+c+d': 'a+b+c+d',
88
'=a': '=a',
99
'%': '%',
1010
'%25': '%',
@@ -20,7 +20,7 @@ const tests = {
2020
'%7 B%ab%%7C%de%%7 D': '%7 B%ab%|%de%%7 D',
2121
'%ab': '%ab',
2222
'%ab%ab%ab': '%ab%ab%ab',
23-
'%61+%4d%4D': 'a MM',
23+
'%61+%4d%4D': 'a+MM',
2424
'\uFEFFtest': '\uFEFFtest',
2525
'\uFEFF': '\uFEFF',
2626
'%EF%BB%BFtest': '\uFEFFtest',

0 commit comments

Comments
 (0)