diff options
author | Guido Günther <agx@sigxcpu.org> | 2014-09-11 07:05:59 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2014-09-11 07:15:15 +0200 |
commit | f818d8a81c3cf1060c69868b9a1374cd232dbb5d (patch) | |
tree | c82e8b7025db12f3cd524828d5205f6b7914f2c3 /industriart/artifactory.py | |
parent | f1f18f7ea5ad0ab400155587b66be77da6e36046 (diff) |
since posixpath.join only picks the absolute one otherwise
Diffstat (limited to 'industriart/artifactory.py')
-rw-r--r-- | industriart/artifactory.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/industriart/artifactory.py b/industriart/artifactory.py index ca409ca..9ca3e87 100644 --- a/industriart/artifactory.py +++ b/industriart/artifactory.py @@ -51,6 +51,12 @@ class Artifactory(object): self.password = password self.base = base + def _strslash(self, path): + """ + Strip leading '/' since posixpath.join will treat it as absolute otherwise + """ + return path.lstrip('/') + def search_gavc(self, groupid=None, artifactid=None, version=None, classifier=None): """ Query the artifactory via Groupid, ArtifacId, Version and classifier @@ -105,7 +111,7 @@ class Artifactory(object): :arg str file: The path of the file """ url = posixpath.join(self.base, 'api', 'storage', - repo, file) + repo, self._strslash(file)) return self.get(url) def _copy_or_move(self, action, source, target): @@ -123,8 +129,8 @@ class Artifactory(object): url = posixpath.join(self.base, 'api', action, - source[0], source[1]) - dst = posixpath.join(target[0], target[1]) + source[0], self._strslash(source[1])) + dst = posixpath.join(target[0], self._strslash(target[1])) log.debug("%s %s", action.capitalize(), url) # Parameter order matters for artifactory |