about summary refs log tree commit diff
path: root/users/glittershark/system/system/machines/mugwump.nix
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2021-04-01T09·15+0200
committersterni <sternenseemann@systemli.org>2021-04-01T13·09+0000
commita5f2b446aa6e33b533cf9e16c325cf2360f69693 (patch)
treef536e8833cccac28a8f7e691542c420406f4ae8e /users/glittershark/system/system/machines/mugwump.nix
parent28b2c79c1459c5ced640cd3e1594267a2bf86101 (diff)
feat(sterni/nix/url): implement urldecoding r/2385
We use builtins.split directly as it should be a bit more efficient as
lib.splitStrings. Also its returning of a list for every regex match is
useful to update the state while parsing the tokens:

* The tokens are obtained by splitting the string at every '%'
* Everytime we see a boundary (that is a list in the returned
  list of builtins.split), we know that the first two chars of
  the next string are a percent encoded character.

One implementation flaw is that it will currently crash if it encounters
mal-formed URLs (since int.fromHex chrashes if it encounters any non
hex digit characters) and accepts some malformed urlencoding like
"foo %A".

Change-Id: I90d08d7a71b16b4f4a4879214abd7aeff46c20c8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2744
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'users/glittershark/system/system/machines/mugwump.nix')
0 files changed, 0 insertions, 0 deletions