Merge pull request #613 from smira/607-trim-slashes

Trim slashes while parsing publish prefix
This commit is contained in:
Andrey Smirnov
2017-08-09 13:36:35 +03:00
committed by GitHub
3 changed files with 26 additions and 0 deletions

View File

@@ -78,6 +78,7 @@ func ParsePrefix(param string) (storage, prefix string) {
} else {
prefix = param
}
prefix = strings.TrimPrefix(strings.TrimSuffix(prefix, "/"), "/")
return
}

View File

@@ -0,0 +1,4 @@
Removing ${HOME}/.aptly/public/ppa/smira/dists...
Removing ${HOME}/.aptly/public/ppa/smira/pool...
Published repository has been removed successfully.

View File

@@ -122,3 +122,24 @@ class PublishDrop6Test(BaseTest):
"""
runCmd = "aptly publish drop sq1"
expectedCode = 1
class PublishDrop7Test(BaseTest):
"""
publish drop: under prefix with trailing & leading slashes
"""
fixtureDB = True
fixturePool = True
fixtureCmds = [
"aptly snapshot create snap1 from mirror gnuplot-maverick",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap1 ppa/smira/",
]
runCmd = "aptly publish drop maverick /ppa/smira/"
gold_processor = BaseTest.expand_environ
def check(self):
super(PublishDrop7Test, self).check()
self.check_not_exists('public/ppa/smira/dists/')
self.check_not_exists('public/ppa/smira/pool/')
self.check_exists('public/ppa/smira/')