finished the upgrade to filament 4. completely revamped the frontend with codex, now it looks great!

This commit is contained in:
2025-11-13 17:48:49 +01:00
parent b311188bc1
commit cf41055cbd
3 changed files with 31 additions and 41 deletions

View File

@@ -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);