Skip to content

Commit 0aec2e7

Browse files
authored
Merge pull request #251 from datalad/bf-URL-url-escape-in-keyUrls
Add patch to URL-escape key paths in HTTP remote URLs
2 parents d18a02c + 68ee8e5 commit 0aec2e7

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
diff --git a/Remote/Git.hs b/Remote/Git.hs
2+
index 6b7dc77d98..4faaea082d 100644
3+
--- a/Remote/Git.hs
4+
+++ b/Remote/Git.hs
5+
@@ -482,7 +482,12 @@ inAnnex' repo rmt st@(State connpool duc _ _ _ _) key
6+
keyUrls :: GitConfig -> Git.Repo -> Remote -> Key -> [String]
7+
keyUrls gc repo r key = map tourl locs'
8+
where
9+
- tourl l = Git.repoLocation repo ++ "/" ++ l
10+
+ tourl l = Git.repoLocation repo ++ "/" ++ escapeURIString escchar l
11+
+ -- Escape characters that are not allowed unescaped in a URI
12+
+ -- path component, but don't escape '/' since the location
13+
+ -- is a path with multiple components.
14+
+ escchar '/' = True
15+
+ escchar c = isUnescapedInURIComponent c
16+
-- If the remote is known to not be bare, try the hash locations
17+
-- used for non-bare repos first, as an optimisation.
18+
locs

0 commit comments

Comments
 (0)