Skip to content

Commit

Permalink
Don't URL encode path components (#2505)
Browse files Browse the repository at this point in the history
Fixes #2467

After dhall-lang/dhall-lang#581 the standard
requires implementations to not do anything special with respect to
URL encoding.  In other words, a conforming implementation:

- Should not URL-encode path components when parsing imports from Dhall
  source code

- Should not URL-encode path components when resolving those same
  imports

The user can still specify an import that uses URL encoded path
components, but the implementation does not give them any special
treatment.  It just blindly forwards those path components undisturbed.

Before this change, the Haskell implementation of Dhall was correctly
handling the first part (not url encoding path components at parse
time) but was still incorrectly handling the second part (because it
would URL encode path components at import resolution time).  This
change fixes that.
  • Loading branch information
Gabriella439 authored Apr 9, 2023
1 parent 7450d1f commit 595d05b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
1 change: 0 additions & 1 deletion dhall/dhall.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ Common common
transformers >= 0.5.2.0 && < 0.7 ,
unix-compat >= 0.4.2 && < 0.7 ,
unordered-containers >= 0.1.3.0 && < 0.3 ,
uri-encode < 1.6 ,
vector >= 0.11.0.0 && < 0.14

if flag(with-http)
Expand Down
4 changes: 1 addition & 3 deletions dhall/src/Dhall/URL.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ import Data.Text (Text)

import Dhall.Syntax (Directory (..), File (..), Scheme (..), URL (..))

import qualified Network.URI.Encode as URI.Encode

renderComponent :: Text -> Text
renderComponent component = "/" <> URI.Encode.encodeText component
renderComponent component = "/" <> component

renderQuery :: Text -> Text
renderQuery query = "?" <> query
Expand Down

0 comments on commit 595d05b

Please sign in to comment.