Skip to content

Commit

Permalink
snippets: urlencode: only 0-9a-f
Browse files Browse the repository at this point in the history
  • Loading branch information
wader committed Sep 12, 2021
1 parent a5b802b commit fda1dda
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dev/snippets.jq
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ def flac_dump:

def urldecode:
gsub(
"%(?<c>..)";
"%(?<c>[a-fA-F0-9]{2})";
( .c
| ascii_downcase
| explode
# "0"-"9" or "a"-"f"
| map(.-48 | if .>=49 then .-39 else . end)
| [.[0]*16+.[1]]
| implode
Expand Down

0 comments on commit fda1dda

Please sign in to comment.