@@ -69,12 +69,12 @@ export class UmbInputUploadFieldElement extends UmbLitElement {
6969
7070 #manager = new UmbTemporaryFileManager ( this ) ;
7171
72- #previewers : Array < ManifestFileUploadPreview > = [ ] ;
72+ #manifests : Array < ManifestFileUploadPreview > = [ ] ;
7373
7474 constructor ( ) {
7575 super ( ) ;
76- new UmbExtensionsManifestInitializer ( this , umbExtensionsRegistry , 'fileUploadPreview' , null , ( previews ) => {
77- this . #previewers = previews . map ( ( preview ) => preview . manifest ) ;
76+ new UmbExtensionsManifestInitializer ( this , umbExtensionsRegistry , 'fileUploadPreview' , null , ( manifests ) => {
77+ this . #manifests = manifests . map ( ( manifest ) => manifest . manifest ) ;
7878 } ) ;
7979 }
8080
@@ -88,23 +88,24 @@ export class UmbInputUploadFieldElement extends UmbLitElement {
8888 }
8989
9090 #getPreviewElementAlias( ) {
91- const fallbackAlias = this . #previewers . find ( ( preview ) => preview . forMimeTypes . includes ( '*/*' ) ) ?. alias ;
91+ const fallbackAlias = this . #manifests . find ( ( manifest ) => manifest . forMimeTypes . includes ( '*/*' ) ) ?. alias ;
9292
9393 const mimeType = this . #getMimeTypeFromPath( this . _src ) ;
9494 if ( ! mimeType ) return fallbackAlias ;
9595
9696 // Check for an exact match
97- const exactMatch = this . #previewers . find ( ( preview ) => {
98- return preview . forMimeTypes . includes ( mimeType ) ;
97+ const exactMatch = this . #manifests . find ( ( manifest ) => {
98+ return manifest . forMimeTypes . includes ( mimeType ) ;
9999 } ) ;
100100 if ( exactMatch ) return exactMatch . alias ;
101101
102102 // Check for wildcard match (e.g. image/*)
103- const wildcardMatch = this . #previewers. find ( ( preview ) => {
104- return preview . forMimeTypes . find ( ( type ) => {
103+ const wildcardMatch = this . #manifests. find ( ( manifest ) => {
104+ const forMimeTypes = Array . isArray ( manifest . forMimeTypes ) ? manifest . forMimeTypes : [ manifest . forMimeTypes ] ;
105+ return forMimeTypes . find ( ( type ) => {
105106 const snippet = type . replace ( / \* / g, '' ) ;
106- if ( mimeType . startsWith ( snippet ) ) return preview . alias ;
107- if ( mimeType . endsWith ( snippet ) ) return preview . alias ;
107+ if ( mimeType . startsWith ( snippet ) ) return manifest . alias ;
108+ if ( mimeType . endsWith ( snippet ) ) return manifest . alias ;
108109 return undefined ;
109110 } ) ;
110111 } ) ;
0 commit comments