feat: enhance media upload handling and MIME type resolution
Deploy Development / deploy (push) Successful in 34s
Test Suite / pytest-backend (push) Successful in 25s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 7s
Test Suite / playwright-tests (push) Successful in 24s
Deploy Development / deploy (push) Successful in 34s
Test Suite / pytest-backend (push) Successful in 25s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 7s
Test Suite / playwright-tests (push) Successful in 24s
- Expanded the allowed upload MIME types to include HEIC, HEIF, and QuickTime formats. - Introduced a new function to resolve MIME types based on file content, filename extensions, and client-provided content types. - Updated media upload logic in both the exercises and media assets routers to utilize the new MIME resolution function. - Adjusted frontend file input accept attributes to allow broader media types, improving user experience. - Enhanced media library components to handle HEIC/HEIF formats with appropriate fallback messaging for browser compatibility.
This commit is contained in:
1 parent
d213746bd2
commit
cc4e621f95
5 files changed
+109
-17
No files matched your search
@@ -153,6 +153,10 @@ function uploaderLabel(it, viewer) {
|
||||
function MediaThumb({ mediaId, mimeType }) {
|
||||
const url = resolveMediaAssetFileUrl(mediaId)
|
||||
const mime = (mimeType || '').toLowerCase()
|
||||
/* iPhone-Fotos: Browser-Vorschau oft nicht nutzbar */
|
||||
if (mime.includes('heic') || mime.includes('heif')) {
|
||||
return <div className="media-library__thumb-ph">HEIC</div>
|
||||
}
|
||||
if (mime.startsWith('video/')) {
|
||||
return (
|
||||
<video
|
||||
@@ -609,7 +613,7 @@ export default function MediaLibraryPage() {
|
||||
ref={bulkFileInputRef}
|
||||
type="file"
|
||||
className="media-library__sr-file"
|
||||
accept="image/jpeg,image/png,image/gif,video/mp4,application/pdf,.jpg,.jpeg,.png,.gif,.mp4,.pdf"
|
||||
accept="image/*,video/*,application/pdf"
|
||||
multiple
|
||||
onChange={onBulkArchiveFiles}
|
||||
/>
|
||||
@@ -857,9 +861,22 @@ export default function MediaLibraryPage() {
|
||||
{(() => {
|
||||
const url = resolveMediaAssetFileUrl(preview.id)
|
||||
const kind = previewDisplayKind(preview.mime_type)
|
||||
const mlow = (preview.mime_type || '').toLowerCase()
|
||||
if (!url) {
|
||||
return <p className="media-library__hint">Keine Datei-URL.</p>
|
||||
}
|
||||
if (mlow.includes('heic') || mlow.includes('heif')) {
|
||||
return (
|
||||
<div className="media-library__preview-fallback">
|
||||
<p className="media-library__hint">
|
||||
HEIC/HEIF — in diesem Browser oft keine eingebettete Vorschau. Zum Ansehen herunterladen oder im neuen Tab öffnen.
|
||||
</p>
|
||||
<a className="btn btn-secondary" href={url} target="_blank" rel="noopener noreferrer">
|
||||
Datei öffnen
|
||||
</a>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
if (kind === 'image') {
|
||||
return (
|
||||
<img
|
||||
|
||||
Reference in new issue
Block a user