Stile werden geladen …
@@ -31,7 +31,8 @@
>
![Style preview]()
@@ -53,13 +54,11 @@
diff --git a/resources/js/Pages/Home.vue b/resources/js/Pages/Home.vue
index b797789..3e1b2c0 100644
--- a/resources/js/Pages/Home.vue
+++ b/resources/js/Pages/Home.vue
@@ -163,6 +163,24 @@ let refreshTimer = null;
const getImageIdentifier = (image) => image?.id ?? image?.image_id ?? null;
+const extractFilenameFromHeader = (disposition) => {
+ if (!disposition) {
+ return null;
+ }
+
+ const filenameMatch = disposition.match(/filename\*=UTF-8''([^;]+)|filename="?([^";]+)"?/i);
+ if (!filenameMatch) {
+ return null;
+ }
+
+ const encodedName = filenameMatch[1] || filenameMatch[2];
+ try {
+ return decodeURIComponent(encodedName);
+ } catch (error) {
+ return encodedName;
+ }
+};
+
watch(
() => props.images,
(newImages) => {
@@ -306,8 +324,12 @@ const downloadImage = (imageParam = null) => {
const blob = new Blob([response.data]);
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
+ const disposition = response.headers?.['content-disposition'];
+ const filenameFromHeader = extractFilenameFromHeader(disposition);
+ const fallbackName = image.name || `stylegallery_${new Date().toISOString().replace(/[:.]/g, '-')}`;
+
link.href = url;
- link.download = image.name || 'image';
+ link.download = filenameFromHeader || fallbackName;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);