@@ -63,7 +63,7 @@ export class UmbInputUploadFieldElement extends UmbLitElement {
63
63
private _extensions ?: string [ ] ;
64
64
65
65
@state ( )
66
- private _previewAlias = '' ;
66
+ private _previewAlias ?: string ;
67
67
68
68
@query ( '#dropzone' )
69
69
private _dropzone ?: UUIFileDropzoneElement ;
@@ -92,7 +92,7 @@ export class UmbInputUploadFieldElement extends UmbLitElement {
92
92
93
93
#getPreviewElementAlias( ) {
94
94
const previews = this . #previewers. getValue ( ) ;
95
- const fallbackAlias = previews . find ( ( preview ) => ! preview . forMimeTypes ?. length ) ?. alias ?? '' ;
95
+ const fallbackAlias = previews . find ( ( preview ) => preview . forMimeTypes . includes ( '*/*' ) ) ?. alias ;
96
96
97
97
const mimeType = this . #getMimeTypeFromPath( this . _src ) ;
98
98
if ( ! mimeType ) return fallbackAlias ;
@@ -101,7 +101,8 @@ export class UmbInputUploadFieldElement extends UmbLitElement {
101
101
return preview . forMimeTypes ?. find ( ( type ) => {
102
102
if ( mimeType === type ) preview . alias ;
103
103
104
- const snippet = type . replace ( '*' , '' ) ;
104
+ const snippet = type . replace ( / \* / g, '' ) ;
105
+
105
106
if ( mimeType . startsWith ( snippet ) ) return preview . alias ;
106
107
if ( mimeType . endsWith ( snippet ) ) return preview . alias ;
107
108
return undefined ;
@@ -174,7 +175,7 @@ export class UmbInputUploadFieldElement extends UmbLitElement {
174
175
` ;
175
176
}
176
177
177
- #renderFile( src : string , previewAlias : string , file ?: File ) {
178
+ #renderFile( src : string , previewAlias ? : string , file ?: File ) {
178
179
if ( ! previewAlias ) return 'An error occurred. No previewer found for the file type.' ;
179
180
return html `
180
181
<div id= "wrapper" >
0 commit comments