escape colons in key files
This commit is contained in:
parent
49b7f59183
commit
6c412fb9f5
1 changed files with 6 additions and 2 deletions
|
@ -118,15 +118,19 @@ isLinkToAnnex s = ("/.git/" ++ objectDir) `isInfixOf` s
|
||||||
- a slash
|
- a slash
|
||||||
- "%" is escaped to "&s", and "&" to "&a"; this ensures that the mapping
|
- "%" is escaped to "&s", and "&" to "&a"; this ensures that the mapping
|
||||||
- is one to one.
|
- is one to one.
|
||||||
|
- ":" is escaped to "&c", because despite it being 2011, people still care
|
||||||
|
- about FAT.
|
||||||
- -}
|
- -}
|
||||||
keyFile :: Key -> FilePath
|
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
|
{- Reverses keyFile, converting a filename fragment (ie, the basename of
|
||||||
- the symlink target) into a key. -}
|
- the symlink target) into a key. -}
|
||||||
fileKey :: FilePath -> Maybe Key
|
fileKey :: FilePath -> Maybe Key
|
||||||
fileKey file = readKey $
|
fileKey file = readKey $
|
||||||
replace "&a" "&" $ replace "&s" "%" $ replace "%" "/" file
|
replace "&a" "&" $ replace "&s" "%" $
|
||||||
|
replace "&c" ":" $ replace "%" "/" file
|
||||||
|
|
||||||
{- for quickcheck -}
|
{- for quickcheck -}
|
||||||
prop_idempotent_fileKey :: String -> Bool
|
prop_idempotent_fileKey :: String -> Bool
|
||||||
|
|
Loading…
Reference in a new issue