Skip to content

Commit

Permalink
Allowed the ' character in routes (#163)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
PhilippMDoerner authored May 22, 2022
1 parent beb834d commit dfcaeef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/prologue/core/route.nim
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import ./httpexception

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

result = path

Expand Down

0 comments on commit dfcaeef

Please sign in to comment.