Skip to content

Commit 690839c

Browse files
committed
Allow to download PGP signatures for latest release
Signed-off-by: Michal Čihař <michal@cihar.com>
1 parent 26f5f5e commit 690839c

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

files/models.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,11 @@ def get_absolute_url(self):
264264
self.__unicode__()
265265
)
266266

267+
def get_signed_url(self):
268+
return 'https://files.phpmyadmin.net{0}.asc'.format(
269+
self.__unicode__()
270+
)
271+
267272
def get_alternate_url(self):
268273
return 'https://1126968067.rsc.cdn77.org{0}'.format(
269274
self.__unicode__()
@@ -314,6 +319,13 @@ def get_absolute_url(self):
314319
self.filename,
315320
)
316321

322+
def get_signed_url(self):
323+
return 'https://files.phpmyadmin.net/themes/{0}/{1}/{2}.asc'.format(
324+
self.name,
325+
self.version,
326+
self.filename,
327+
)
328+
317329
def get_filesystem_path(self):
318330
return os.path.join(
319331
settings.FILES_PATH,

files/views.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,15 @@ def version_json(request):
8484
)
8585

8686

87-
def latest_download(request, flavor, extension):
87+
def latest_download(request, flavor, extension, checksum=None):
88+
print checksum
8889
latest = Release.objects.filter(stable=True)[0]
8990
try:
9091
result = latest.download_set.get(
9192
filename__endswith='-{0}{1}'.format(flavor, extension)
9293
)
94+
if checksum == '.asc':
95+
return redirect(result.get_signed_url(), permanent=False)
9396
return redirect(result, permanent=False)
9497
except Download.DoesNotExist:
9598
raise Http404("No release found matching the query")

pmaweb/urls.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@
339339
url(
340340
r'^downloads/phpMyAdmin-latest-'
341341
r'(?P<flavor>all-languages|english)'
342-
r'(?P<extension>\.zip|\.tar\.gz|\.tar\.xz|\.tar\.bz2)$',
342+
r'(?P<extension>\.zip|\.tar\.gz|\.tar\.xz|\.tar\.bz2)'
343+
r'(?P<checksum>\.asc)?$',
343344
latest_download,
344345
),
345346
url(

0 commit comments

Comments
 (0)