correct folder and image names in zip, correct zip file name

This commit is contained in:
admin 2026-02-25 16:14:58 -08:00
parent fa778d5360
commit 2ecf6e2501

5
app.py
View File

@ -34,6 +34,7 @@ def index():
'NIV': 'niv', 'NIV': 'niv',
'NLT': 'nlt' 'NLT': 'nlt'
}.get(version) }.get(version)
filenameref = reference.replace(' ', '_').replace(':', '_')
if bible_id and reference: if bible_id and reference:
webfriendlyref=reference.replace(' ','%20').replace(':','%3A') webfriendlyref=reference.replace(' ','%20').replace(':','%3A')
@ -87,7 +88,7 @@ def index():
# You can now send png_bytes to a response or store it in a DB # You can now send png_bytes to a response or store it in a DB
print(f"Page {page_index} is {len(png_bytes)} bytes.") print(f"Page {page_index} is {len(png_bytes)} bytes.")
zf.writestr("SLIDES/{:04d}.png".format(page_index), png_bytes) zf.writestr("{}/{}{:04d}.png".format(filenameref, filenameref, page_index), png_bytes)
doc.close() doc.close()
@ -100,7 +101,7 @@ def index():
memory_file, memory_file,
mimetype='application/zip', mimetype='application/zip',
as_attachment=True, as_attachment=True,
download_name='downloaded_files.zip' # Use download_name for modern Flask versions download_name='{}.zip'.format(filenameref) # Use download_name for modern Flask versions
) )
print(f"Reference: {reference}, Version: {version}, Text: {verse_text}, Error: {error}") print(f"Reference: {reference}, Version: {version}, Text: {verse_text}, Error: {error}")