Bugfix: Fix media uploads that had wrong file extensions
This commit is contained in:
committed by
Jacob Overgaard
parent
86f8495c05
commit
a0e6c9b1e6
@@ -45,7 +45,12 @@ export class UmbInputUploadFieldElement extends UUIFormControlMixin(UmbLitElemen
|
||||
* @default undefined
|
||||
*/
|
||||
@property({ type: Array })
|
||||
fileExtensions?: Array<string>;
|
||||
set fileExtensions(value: Array<string>) {
|
||||
this.#setExtensions(value);
|
||||
}
|
||||
get fileExtensions(): Array<string> | undefined {
|
||||
return this.extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Allows the user to upload multiple files.
|
||||
@@ -104,11 +109,6 @@ export class UmbInputUploadFieldElement extends UUIFormControlMixin(UmbLitElemen
|
||||
});
|
||||
}
|
||||
|
||||
connectedCallback(): void {
|
||||
super.connectedCallback();
|
||||
this.#setExtensions();
|
||||
}
|
||||
|
||||
async #setFilePaths() {
|
||||
await this.#serverUrlPromise;
|
||||
|
||||
@@ -123,11 +123,9 @@ export class UmbInputUploadFieldElement extends UUIFormControlMixin(UmbLitElemen
|
||||
});
|
||||
}
|
||||
|
||||
#setExtensions() {
|
||||
if (!this.fileExtensions?.length) return;
|
||||
|
||||
#setExtensions(value: Array<string>) {
|
||||
// TODO: The dropzone uui component does not support file extensions without a dot. Remove this when it does.
|
||||
this.extensions = this.fileExtensions.map((extension) => {
|
||||
this.extensions = value.map((extension) => {
|
||||
return `.${extension}`;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -15,9 +15,7 @@ export class UmbPropertyEditorUIUploadFieldElement extends UmbLitElement impleme
|
||||
public set config(config: UmbPropertyEditorConfigCollection | undefined) {
|
||||
if (!config) return;
|
||||
|
||||
this._fileExtensions = config
|
||||
.getValueByAlias<{ id: number; value: string }[]>('fileExtensions')
|
||||
?.map((ext) => ext.value);
|
||||
this._fileExtensions = config.getValueByAlias<Array<string>>('fileExtensions');
|
||||
|
||||
this._multiple = config.getValueByAlias('multiple');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user