From 5754c66891575e82d422e3c19fb2bf7d40c6a0eb Mon Sep 17 00:00:00 2001 From: Troy Dawson Date: Oct 10 2022 22:04:15 +0000 Subject: Fix download sources on SIG branches --- diff --git a/src/centpkg/lookaside.py b/src/centpkg/lookaside.py index d9a97a6..5193e12 100644 --- a/src/centpkg/lookaside.py +++ b/src/centpkg/lookaside.py @@ -207,32 +207,31 @@ class SIGLookasideCache(CGILookasideCache): It inherits most of its behavior from `pyrpkg.lookasideCGILookasideCache`. """ - def __init__(self, hashtype, download_url, upload_url, name, branch, structure='hash'): + def __init__(self, hashtype, download_url, upload_url, name, branch, structure='hash', client_cert=None, ca_cert=None): super(SIGLookasideCache, self).__init__( - hashtype, download_url, upload_url, - client_cert=client_cert, ca_cert=ca_cert) - + hashtype, download_url, upload_url, client_cert=client_cert, ca_cert=ca_cert) + self.name = name self.branch = branch self.structure = structure - @property - def download_path(self): - if self.structure == 'hash': - return '%(name)s/%(filename)s/%(hashtype)s/%(hash)s' - return '%(name)s/%(branch)s/%(hash)s' - def get_download_url(self, name, filename, hash, hashtype=None, **kwargs): if self.structure == 'hash': + download_path = '%(name)s/%(branch)s/%(hash)s' + if "/" in name: + real_name = name.split("/")[-1] + else: + real_name = name path_dict = { - 'name': name, - 'filename': filename, - 'hash': hash, - 'hashtype': hashtype + 'name': real_name, + 'filename': filename, + 'branch': self.branch, + 'hash': hash, + 'hashtype': hashtype } - path = self.download_path % path_dict + path = download_path % path_dict return os.path.join(self.download_url, path) - + return super(SIGLookasideCache, self).get_download_url(name, filename, hash, hashtype, **kwargs) def remote_file_exists(self, name, filename, hash):