Don't use unsupported download attribute with preferred filename

main
Bob Mottram 2024-08-14 12:37:38 +01:00
parent 1691461149
commit 2c8d8825ce
3 changed files with 15 additions and 10 deletions

View File

@ -831,16 +831,14 @@ def html_hashtag_maps(base_dir: str, tag_name: str,
period_str2 = period_str.replace('Last ', '').lower()
endpoint_str = \
'/tagmaps/' + tag_name + '-' + period_str2.replace(' ', '_')
download_filename = \
(tag_name + '-' +
period_str.lower()).replace(' ', '_') + '.' + map_format
if html_str:
html_str += ' '
description = period_str
if translate.get(period_str):
description = translate[period_str]
html_str += '<a href="' + endpoint_str + \
'" download="' + download_filename + '">' + \
# NOTE: don't use download="preferredfilename" which is
# unsupported by some browsers
html_str += '<a href="' + endpoint_str + '" download>' + \
description + '</a>'
if html_str:
html_str = '📌 ' + html_str

View File

@ -336,9 +336,11 @@ def _html_calendar_day(person_cache: {}, translate: {},
calendar_str += '</table>\n</main>\n'
# icalendar download link
# NOTE: don't use download="preferredfilename" which is
# unsupported by some browsers
calendar_str += \
' <a href="' + path + '?ical=true" ' + \
'download="icalendar.ics" class="imageAnchor" tabindex="3">' + \
'download class="imageAnchor" tabindex="3">' + \
'<img class="ical" src="/icons/ical.png" ' + \
'title="iCalendar" alt="iCalendar" /></a>\n'
@ -657,9 +659,11 @@ def html_calendar(person_cache: {}, translate: {},
translate['Add to the calendar'] + '</a></p>\n<p>' + \
show_reminders_link + '</p>\n</center>\n'
# NOTE: don't use download="preferredfilename" which is
# unsupported by some browsers
calendar_icon_str = \
' <a href="' + path + '?ical=true" ' + \
'download="icalendar.ics" class="imageAnchor" tabindex="3">' + \
'download class="imageAnchor" tabindex="3">' + \
'<img class="ical" src="/icons/ical.png" ' + \
'title="iCalendar" alt="iCalendar" /></a>\n'

View File

@ -783,10 +783,11 @@ def _get_profile_header(base_dir: str, http_prefix: str, nickname: str,
translate)
# show vcard download link
# NOTE: don't use download="preferredfilename" which is
# unsupported by some browsers
html_str += \
' <a href="/users/' + nickname + '.vcf" ' + \
'type="text/vcard" ' + \
'tabindex="1" class="imageAnchor">' + \
'type="text/vcard" tabindex="1" class="imageAnchor">' + \
'<img class="vcard" src="/icons/vcard.png" ' + \
'title="vCard" alt="vCard" /></a>\n'
@ -2842,9 +2843,11 @@ def _html_edit_profile_import_export(nickname: str, domain: str,
'<p><a href="/users/' + nickname + \
'/followingaccounts"><label class="labels">' + \
translate['Following'] + '</label></a>'
# NOTE: don't use download="preferredfilename" which is
# unsupported by some browsers
edit_profile_form += \
' <a href="/users/' + nickname + '/followingaccounts.csv" ' + \
'download="' + nickname + '@' + domain + '_following.csv">' + \
'download>' + \
'<label class="labels">⇩ CSV</label></a></p><br>\n'
followers_str = translate['Followers']
if premium: