mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
manual: Download can serve either pdf or pdf.gz file
Fixes the problem where an installation might not have a gzipped version of the manual (like the Plinth development VM for example). Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
3bafdb3789
commit
0b6006968e
@ -91,6 +91,12 @@ def download_manual(request):
|
||||
try:
|
||||
with gzip.open(os.path.join(cfg.doc_dir, manual_name), 'rb') as f:
|
||||
content = f.read()
|
||||
except IOError:
|
||||
try:
|
||||
# pdf.gz doesn't exist. Try with .pdf
|
||||
manual_name = manual_name.rpartition('.')[0]
|
||||
with open(os.path.join(cfg.doc_dir, manual_name), 'rb') as f:
|
||||
content = f.read()
|
||||
except IOError:
|
||||
raise Http404('File {} does not exist.'.format(manual_name))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user