webapp: Avoid illegal characters in hostname when creating S3 or Glacier remote.

This commit is contained in:
Joey Hess 2013-01-14 12:54:29 -04:00
parent 529f698960
commit 0d2ac184b5
3 changed files with 11 additions and 1 deletions

View file

@ -25,6 +25,7 @@ import Logs.PreferredContent
import qualified Data.Text as T
import qualified Data.Map as M
import Data.Char
awsConfigurator :: Widget -> Handler RepHtml
awsConfigurator = page "Add an Amazon repository" (Just Configuration)
@ -175,8 +176,14 @@ makeAWSRemote remotetype (AWSCreds ak sk) name setup config = do
remotename <- runAnnex name $ fromRepo $ uniqueRemoteName name 0
liftIO $ AWS.setCredsEnv (T.unpack ak, T.unpack sk)
r <- liftAssistant $ liftAnnex $ addRemote $ do
makeSpecialRemote name remotetype config
makeSpecialRemote hostname remotetype config
return remotename
setup r
liftAssistant $ syncNewRemote r
redirect $ EditNewCloudRepositoryR $ Remote.uuid r
where
{- AWS services use the remote name as the basis for a host
- name, so filter it to contain valid characters. -}
hostname = case filter isAlphaNum name of
[] -> "aws"
n -> n

2
debian/changelog vendored
View file

@ -17,6 +17,8 @@ git-annex (3.20130108) UNRELEASED; urgency=low
* In direct mode, files with the same key are no longer hardlinked, as
that would cause a surprising behavior if modifying one, where the other
would also change.
* webapp: Avoid illegal characters in hostname when creating S3 or
Glacier remote.
-- Joey Hess <joeyh@debian.org> Tue, 08 Jan 2013 12:37:38 -0400

View file

@ -15,3 +15,4 @@ What version of git-annex are you using? On what operating system?
Please provide any additional information below.
> [[done]], the name will now be sanitized. --[[Joey]]