mirror of
https://github.com/goauthentik/authentik
synced 2026-05-10 17:12:08 +02:00
* web/admin: fix file upload not preserving extension for custom names with dots Overview: The `hasBasenameExtension()` function in `FileUploadForm.ts` incorrectly determined whether a custom filename already had an extension by checking if it contained any dot at position > 0. This caused filenames like "e._.e" to be treated as having an extension, so the original file's extension was not appended. The file would be saved as "e._.e" instead of "e._.e.jpg", which caused `mimetypes.guess_type()` to return `None` (since ".e" is not a recognized extension) and the backend to fall back to "application/octet-stream". Removed `hasBasenameExtension()` entirely. Since the UI explicitly states "Optionally rename the file (without extension)", we now always append the original file's extension when a custom name is provided. Testing: 1. Upload a JPG file with custom name "e" --> saves as "e.jpg", and is detected as "image/jpeg" 2. Upload a JPG file with custom name "e._.e" --> now saves as "e._.e.jpg",and is detected as "image/jpeg" Motivation: Fixes incorrect MIME type detection for uploaded files when users provide custom filenames containing dots. * web: lint * web: Ken's suggestion