Dear Guile developers, Some time ago, Nathan wrote this patch as a better version of mine, and I would really like to see it merged.
Does it need more improvement? I consider it pretty good. Best regards, Vivien Le jeudi 02 novembre 2023 à 16:00 -0400, Nathan a écrit : > There is a problem and I fixed it by rewriting a bunch of code myself > because I need similar code. > > remove-dot-segments: > You cannot split-and-decode-uri-path and then encode-and-join-uri- > path. > Those are terrible functions that don't work on all URIs. > URI schemes are allowed to specify that certain reserved characters > (sub-delims) are special. > In that case, a sub-delim that IS escaped is different from a sub- > delim that IS NOT escaped. > > Example input to your remove-dot-segments: > (resolve-relative-reference (string->uri-reference "/") (string->uri- > reference "excitement://a.com/a!a!%21!")) > Your wrong output: > excitement://a.com/a%21a%21%21%21 > > One solution would be to only percent-decode dots. Because dot is > unreserved, that solution doesn't have any URI equivalence issues. > But I still think decoding dots automatically is a bad, unexpected > side-effect to have. > I rewrote this function so that it: > - works on both escaped and unescaped dots > - doesn't unescape any unnecessary characters > > The test suite no longer needs to check for incorrect output either: > > ;; The test suite checks for ';' characters, but Guile escapes > > ;; them in URIs. Same for '='. > > ---- > > resolve-relative-reference: > I rewrote this procedure so it is shorter. > I also added #:strict? to toggle "strict parser" as mentioned in the > RFC. > > - Nathan