diff options
Diffstat (limited to 'Backend/URL.hs')
-rw-r--r-- | Backend/URL.hs | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/Backend/URL.hs b/Backend/URL.hs index ace578a24..a8161c98d 100644 --- a/Backend/URL.hs +++ b/Backend/URL.hs @@ -10,11 +10,10 @@ module Backend.URL ( fromUrl ) where -import Data.Hash.MD5 - import Common.Annex import Types.Backend import Types.Key +import Backend.Utilities backends :: [Backend] backends = [backend] @@ -27,18 +26,12 @@ backend = Backend , canUpgradeKey = Nothing } -{- When it's not too long, use the full url as the key name. - - If the url is too long, it's truncated at half the filename length - - limit, and the md5 of the url is prepended to ensure a unique key. -} +{- Every unique url has a corresponding key. -} fromUrl :: String -> Maybe Integer -> Annex Key fromUrl url size = do - limit <- liftIO . fileNameLengthLimit =<< fromRepo gitAnnexDir - let truncurl = truncateFilePath (limit `div` 2) url - let key = if url == truncurl - then url - else truncurl ++ "-" ++ md5s (Str url) + n <- genKeyName url return $ stubKey - { keyName = key + { keyName = n , keyBackendName = "URL" , keySize = size - } + } |