Fix bugs with prefix/storage parsing. #15

This commit is contained in:
Andrey Smirnov
2014-07-22 00:27:49 +04:00
parent 71d90947c9
commit 52bb33dc69
2 changed files with 6 additions and 3 deletions

View File

@@ -210,9 +210,9 @@ func (context *AptlyContext) GetPublishedStorage(name string) aptly.PublishedSto
if name == "" {
publishedStorage = files.NewPublishedStorage(context.Config().RootDir)
} else if strings.HasPrefix(name, "s3:") {
params, ok := context.Config().S3PublishRoots[name[4:]]
params, ok := context.Config().S3PublishRoots[name[3:]]
if !ok {
Fatal(fmt.Errorf("published S3 storage %v not configured", name[4:]))
Fatal(fmt.Errorf("published S3 storage %v not configured", name[3:]))
}
var err error

View File

@@ -28,8 +28,11 @@ func getSigner(flags *flag.FlagSet) (utils.Signer, error) {
func parsePrefix(param string) (storage, prefix string) {
i := strings.LastIndex(param, ":")
if i != -1 {
storage = param[:i+1]
storage = param[:i]
prefix = param[i+1:]
if prefix == "" {
prefix = "."
}
} else {
prefix = param
}