Skip to content

Commit dfcaeef

Browse files
Allowed the ' character in routes (#163)
The character is an unescaped character for URLs and thus should do no harm when used within a URL. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent In fact, in Django (python web-framework) it is possible to have the `'` character within URLs without any problem. Thus that character should allowed.
1 parent beb834d commit dfcaeef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/prologue/core/route.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import ./httpexception
2929

3030
const
3131
pathSeparator = '/'
32-
allowedCharsInUrl = {'a'..'z', 'A'..'Z', '0'..'9', '-', '.', '_', '~', '%', pathSeparator}
32+
allowedCharsInUrl = {'a'..'z', 'A'..'Z', '0'..'9', '-', '.', '_', '~', '%', '\'', pathSeparator}
3333
wildcard = '*'
3434
startParam = '{'
3535
endParam = '}'
@@ -130,7 +130,7 @@ func ensureCorrectRoute(
130130
## Verifies that this given path is a valid path, strips trailing slashes, and guarantees leading slashes.
131131
if(not path.allCharsInSet(allowedCharsInPattern)):
132132
raise newException(RouteError, "Illegal characters occurred in the mapped pattern," &
133-
"please restrict to alphanumeric, or the following: - . _ ~ / * { } &")
133+
"please restrict to alphanumeric, or the following: - . _ ~ / * { } & '")
134134

135135
result = path
136136

0 commit comments

Comments
 (0)