mirror of
https://github.com/modrinth/code.git
synced 2026-08-28 10:34:53 +00:00
fix: add download attribute to fix JAR files saving as ZIP in Chromium (#6065)
* fix: add download attribute to fix JAR files saving as ZIP in Chromium - JAR files were downloading with a `.zip` extension in Chromium-based browsers (Chrome, Edge, Arc, Brave, Opera, Vivaldi) - Root cause: JAR files are ZIP archives internally, so Chromium sniffs the `Content-Type` as `application/zip` and overrides the filename extension when no `download` attribute is present - Fix: add `download="<filename>"` to all file download `<a>` tags so the browser uses the original filename from the API * fix: add download attribute to remaining download links Missed in initial pass: changelog page button, versions overflow menu, settings/versions overflow menu. Also adds `download` prop to Button and OverflowMenu to support dropdown link items. Adds missing `getPrimaryFile` definition in changelog.vue. --------- Co-authored-by: Mr_chank <180248271+chank-op@users.noreply.github.com> Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
This commit is contained in:
co-authored by
Mr_chank
Prospector
parent
e9eb98f97e
commit
02a7774722
@@ -11,6 +11,10 @@ const props = defineProps({
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
download: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
action: {
|
||||
type: Function,
|
||||
default: null,
|
||||
@@ -106,6 +110,7 @@ const classes = computed(() => {
|
||||
class="btn"
|
||||
:class="classes"
|
||||
:href="disabled ? undefined : link"
|
||||
:download="download || undefined"
|
||||
:target="external ? '_blank' : '_self'"
|
||||
@click="
|
||||
(event) => {
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
: undefined
|
||||
"
|
||||
:link="option.link ? option.link : undefined"
|
||||
:download="option.download ? option.download : undefined"
|
||||
:external="option.external ? option.external : false"
|
||||
:disabled="option.disabled"
|
||||
@click="
|
||||
@@ -76,6 +77,7 @@ interface Item extends BaseOption {
|
||||
icon?: Component
|
||||
action?: (event?: MouseEvent) => void
|
||||
link?: string
|
||||
download?: string
|
||||
external?: boolean
|
||||
color?:
|
||||
| 'primary'
|
||||
|
||||
Reference in New Issue
Block a user