S3: Add fileprefix setting.

This commit is contained in:
Joey Hess 2012-08-09 13:54:54 -04:00
parent 5fc8c2b07b
commit ad4e152fd6
3 changed files with 17 additions and 3 deletions

View file

@ -212,9 +212,11 @@ s3Action r noconn action = do
bucketFile :: Remote -> Key -> FilePath
bucketFile r = munge . show
where
munge s = case M.lookup "mungekeys" $ fromJust $ config r of
Just "ia" -> iaMunge s
_ -> s
munge s = case M.lookup "mungekeys" c of
Just "ia" -> iaMunge $ prefix ++ s
_ -> prefix ++ s
prefix = M.findWithDefault "" "fileprefix" c
c = fromJust $ config r
bucketKey :: Remote -> String -> Key -> S3Object
bucketKey r bucket k = S3Object bucket (bucketFile r k) "" [] L.empty