diff options
author | Joey Hess <joey@kitenet.net> | 2011-03-15 23:39:04 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-03-15 23:39:04 -0400 |
commit | 6c412fb9f55155b0b7bf58d578e51640514ec562 (patch) | |
tree | 540cbe9d744ff04c1144f5e1e992976f8e6aea4c /Locations.hs | |
parent | 49b7f5918341c30140779ea1f376b4d9f81d8a30 (diff) |
escape colons in key files
Diffstat (limited to 'Locations.hs')
-rw-r--r-- | Locations.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Locations.hs b/Locations.hs index 6cff91088..9ffcd9f42 100644 --- a/Locations.hs +++ b/Locations.hs @@ -118,15 +118,19 @@ isLinkToAnnex s = ("/.git/" ++ objectDir) `isInfixOf` s - a slash - "%" is escaped to "&s", and "&" to "&a"; this ensures that the mapping - is one to one. + - ":" is escaped to "&c", because despite it being 2011, people still care + - about FAT. - -} keyFile :: Key -> FilePath -keyFile key = replace "/" "%" $ replace "%" "&s" $ replace "&" "&a" $ show key +keyFile key = replace "/" "%" $ replace ":" "&c" $ + replace "%" "&s" $ replace "&" "&a" $ show key {- Reverses keyFile, converting a filename fragment (ie, the basename of - the symlink target) into a key. -} fileKey :: FilePath -> Maybe Key fileKey file = readKey $ - replace "&a" "&" $ replace "&s" "%" $ replace "%" "/" file + replace "&a" "&" $ replace "&s" "%" $ + replace "&c" ":" $ replace "%" "/" file {- for quickcheck -} prop_idempotent_fileKey :: String -> Bool |