muffin-admin 3.14.1 → 3.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muffin-admin",
3
- "version": "3.14.1",
3
+ "version": "3.15.0",
4
4
  "description": "NPM package for https://github.com/klen/muffin-admin",
5
5
  "files": [
6
6
  "src",
@@ -96,7 +96,10 @@ export function MuffinDataprovider(apiUrl: string) {
96
96
  const url = window.URL.createObjectURL(await response.blob())
97
97
  const link = document.createElement("a")
98
98
  link.href = url
99
- link.setAttribute("download", path)
99
+ const filename =
100
+ response.headers.get("content-disposition")?.split("filename=")[1] || path.split("/").pop()
101
+ link.setAttribute("download", filename)
102
+ if (filename) link.setAttribute("download", filename)
100
103
  link.click()
101
104
  // no need to append link as child to body.
102
105
  setTimeout(() => window.URL.revokeObjectURL(url), 0) // this is important too, otherwise we will be unnecessarily spiking memory!