diff options
author | bptato <nincsnevem662@gmail.com> | 2022-02-19 11:55:06 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-02-19 11:58:09 +0100 |
commit | 7fd9de65e4acfdbb71b284353043c19e2f152acd (patch) | |
tree | 2cb988ec79503197597ee493830600573e47748f /src/utils/twtstr.nim | |
parent | 8efeab3d8770d0e5beaaa872a161d18b90d67658 (diff) | |
download | chawan-7fd9de65e4acfdbb71b284353043c19e2f152acd.tar.gz |
Fix not being able to load local files with ?, #, etc
Diffstat (limited to 'src/utils/twtstr.nim')
-rw-r--r-- | src/utils/twtstr.nim | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim index 6f324f49..df8cfa6e 100644 --- a/src/utils/twtstr.nim +++ b/src/utils/twtstr.nim @@ -411,6 +411,11 @@ const PathPercentEncodeSet* = (QueryPercentEncodeSet + {'?', '`', '{', '}'}) const UserInfoPercentEncodeSet* = (PathPercentEncodeSet + {'/', ':', ';', '=', '@', '['..'^', '|'}) const ComponentPercentEncodeSet* = (UserInfoPercentEncodeSet + {'$'..'&', '+', ','}) const ApplicationXWWWFormUrlEncodedSet* = (ComponentPercentEncodeSet + {'!', '\''..')', '~'}) +# used by client +when defined(windows) or defined(OS2) or defined(DOS): + const LocalPathPercentEncodeSet* = (QueryPercentEncodeSet + {'?', ':'}) +else: + const LocalPathPercentEncodeSet* = (QueryPercentEncodeSet + {'?', ':', '\\'}) proc percentEncode*(append: var string, c: char, set: set[char], spaceAsPlus = false) {.inline.} = if spaceAsPlus and c == ' ': @@ -428,6 +433,9 @@ proc percentEncode*(append: var string, s: string, set: set[char], spaceAsPlus = func percentEncode*(c: char, set: set[char]): string {.inline.} = result.percentEncode(c, set) +func percentEncode*(s: string, set: set[char]): string = + result.percentEncode(s, set) + func percentDecode*(input: string): string = var i = 0 while i < input.len: |