Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
uritemplate-js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
uritemplate-js
Commits
3691704b
Commit
3691704b
authored
Jan 21, 2013
by
Franz X Antesberger
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9 from RubenVerborgh/percentencoding
Correctly encode percent signs in URIs
parents
21505bd8
47ba089e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
16 deletions
+7
-16
src/LiteralExpression.js
src/LiteralExpression.js
+2
-7
src/encodingHelper.js
src/encodingHelper.js
+2
-7
src/rfcCharHelper.js
src/rfcCharHelper.js
+2
-1
uritemplate-test
uritemplate-test
+1
-1
No files found.
src/LiteralExpression.js
View file @
3691704b
...
@@ -9,13 +9,8 @@ var LiteralExpression = (function () {
...
@@ -9,13 +9,8 @@ var LiteralExpression = (function () {
index
,
index
,
chr
=
''
;
chr
=
''
;
for
(
index
=
0
;
index
<
literal
.
length
;
index
+=
chr
.
length
)
{
for
(
index
=
0
;
index
<
literal
.
length
;
index
+=
chr
.
length
)
{
chr
=
pctEncoder
.
pctCharAt
(
literal
,
index
);
chr
=
literal
.
charAt
(
index
);
if
(
chr
.
length
>
0
)
{
result
+=
rfcCharHelper
.
isReserved
(
chr
)
||
rfcCharHelper
.
isUnreserved
(
chr
)
?
chr
:
pctEncoder
.
encodeCharacter
(
chr
);
result
+=
chr
;
}
else
{
result
+=
rfcCharHelper
.
isReserved
(
chr
)
||
rfcCharHelper
.
isUnreserved
(
chr
)
?
chr
:
pctEncoder
.
encodeCharacter
(
chr
);
}
}
}
return
result
;
return
result
;
}
}
...
...
src/encodingHelper.js
View file @
3691704b
...
@@ -15,13 +15,8 @@ var encodingHelper = (function () {
...
@@ -15,13 +15,8 @@ var encodingHelper = (function () {
text
=
text
.
toString
();
text
=
text
.
toString
();
}
}
for
(
index
=
0
;
index
<
text
.
length
;
index
+=
chr
.
length
)
{
for
(
index
=
0
;
index
<
text
.
length
;
index
+=
chr
.
length
)
{
chr
=
pctEncoder
.
pctCharAt
(
text
,
index
);
chr
=
text
.
charAt
(
index
);
if
(
chr
.
length
>
1
)
{
result
+=
rfcCharHelper
.
isUnreserved
(
chr
)
||
(
passReserved
&&
rfcCharHelper
.
isReserved
(
chr
))
?
chr
:
pctEncoder
.
encodeCharacter
(
chr
);
result
+=
chr
;
}
else
{
result
+=
rfcCharHelper
.
isUnreserved
(
chr
)
||
(
passReserved
&&
rfcCharHelper
.
isReserved
(
chr
))
?
chr
:
pctEncoder
.
encodeCharacter
(
chr
);
}
}
}
return
result
;
return
result
;
}
}
...
...
src/rfcCharHelper.js
View file @
3691704b
...
@@ -23,12 +23,13 @@ var rfcCharHelper = (function () {
...
@@ -23,12 +23,13 @@ var rfcCharHelper = (function () {
/**
/**
* Returns if chr is an reserved character according 1.5 of rfc 6570
* Returns if chr is an reserved character according 1.5 of rfc 6570
* or the percent character mentioned in 3.2.1.
* @param chr
* @param chr
* @return {Boolean}
* @return {Boolean}
*/
*/
function
isReserved
(
chr
)
{
function
isReserved
(
chr
)
{
return
chr
===
'
:
'
||
chr
===
'
/
'
||
chr
===
'
?
'
||
chr
===
'
#
'
||
chr
===
'
[
'
||
chr
===
'
]
'
||
chr
===
'
@
'
||
chr
===
'
!
'
||
chr
===
'
$
'
||
chr
===
'
&
'
||
chr
===
'
(
'
||
return
chr
===
'
:
'
||
chr
===
'
/
'
||
chr
===
'
?
'
||
chr
===
'
#
'
||
chr
===
'
[
'
||
chr
===
'
]
'
||
chr
===
'
@
'
||
chr
===
'
!
'
||
chr
===
'
$
'
||
chr
===
'
&
'
||
chr
===
'
(
'
||
chr
===
'
)
'
||
chr
===
'
*
'
||
chr
===
'
+
'
||
chr
===
'
,
'
||
chr
===
'
;
'
||
chr
===
'
=
'
||
chr
===
"
'
"
;
chr
===
'
)
'
||
chr
===
'
*
'
||
chr
===
'
+
'
||
chr
===
'
,
'
||
chr
===
'
;
'
||
chr
===
'
=
'
||
chr
===
"
'
"
||
chr
===
'
%
'
;
}
}
return
{
return
{
...
...
uritemplate-test
@
b317372c
Subproject commit
6aad87eb6f7763e9806b9345dd90e697be6b1bbf
Subproject commit
b317372c613f1aab82f1e497146b2859144b9308
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment