mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-16 07:52:35 +03:00
Sanitise tags at point of reading
This commit is contained in:
parent
38f975dd49
commit
1fa6ecc1eb
1 changed files with 11 additions and 5 deletions
|
@ -504,7 +504,13 @@ class vcs:
|
||||||
|
|
||||||
# Get a list of all known tags
|
# Get a list of all known tags
|
||||||
def gettags(self):
|
def gettags(self):
|
||||||
raise VCSException('gettags not supported for this vcs type')
|
if not self._gettags:
|
||||||
|
raise VCSException('gettags not supported for this vcs type')
|
||||||
|
rtags = []
|
||||||
|
for tag in self._gettags():
|
||||||
|
if re.match('[-A-Za-z0-9_. ]+$', tag):
|
||||||
|
rtags.append(tag)
|
||||||
|
return rtags
|
||||||
|
|
||||||
# Get a list of latest number tags
|
# Get a list of latest number tags
|
||||||
def latesttags(self, number):
|
def latesttags(self, number):
|
||||||
|
@ -613,7 +619,7 @@ class vcs_git(vcs):
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise VCSException("Git submodule update failed", p.output)
|
raise VCSException("Git submodule update failed", p.output)
|
||||||
|
|
||||||
def gettags(self):
|
def _gettags(self):
|
||||||
self.checkrepo()
|
self.checkrepo()
|
||||||
p = FDroidPopen(['git', 'tag'], cwd=self.local, output=False)
|
p = FDroidPopen(['git', 'tag'], cwd=self.local, output=False)
|
||||||
return p.output.splitlines()
|
return p.output.splitlines()
|
||||||
|
@ -742,7 +748,7 @@ class vcs_gitsvn(vcs):
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise VCSException("Git clean failed", p.output)
|
raise VCSException("Git clean failed", p.output)
|
||||||
|
|
||||||
def gettags(self):
|
def _gettags(self):
|
||||||
self.checkrepo()
|
self.checkrepo()
|
||||||
for treeish in ['origin/', '']:
|
for treeish in ['origin/', '']:
|
||||||
d = os.path.join(self.local, '.git', 'svn', 'refs', 'remotes', treeish, 'tags')
|
d = os.path.join(self.local, '.git', 'svn', 'refs', 'remotes', treeish, 'tags')
|
||||||
|
@ -795,7 +801,7 @@ class vcs_hg(vcs):
|
||||||
elif p.returncode != 0:
|
elif p.returncode != 0:
|
||||||
raise VCSException("HG purge failed", p.output)
|
raise VCSException("HG purge failed", p.output)
|
||||||
|
|
||||||
def gettags(self):
|
def _gettags(self):
|
||||||
p = FDroidPopen(['hg', 'tags', '-q'], cwd=self.local, output=False)
|
p = FDroidPopen(['hg', 'tags', '-q'], cwd=self.local, output=False)
|
||||||
return p.output.splitlines()[1:]
|
return p.output.splitlines()[1:]
|
||||||
|
|
||||||
|
@ -826,7 +832,7 @@ class vcs_bzr(vcs):
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise VCSException("Bzr revert of '%s' failed" % rev, p.output)
|
raise VCSException("Bzr revert of '%s' failed" % rev, p.output)
|
||||||
|
|
||||||
def gettags(self):
|
def _gettags(self):
|
||||||
p = FDroidPopen(['bzr', 'tags'], cwd=self.local, output=False)
|
p = FDroidPopen(['bzr', 'tags'], cwd=self.local, output=False)
|
||||||
return [tag.split(' ')[0].strip() for tag in
|
return [tag.split(' ')[0].strip() for tag in
|
||||||
p.output.splitlines()]
|
p.output.splitlines()]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue