diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/components/input-upload-field/preview/input-upload-field-file.element.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/components/input-upload-field/preview/input-upload-field-file.element.ts index a5dbf5ca44..6f7412d1a1 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media/components/input-upload-field/preview/input-upload-field-file.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media/components/input-upload-field/preview/input-upload-field-file.element.ts @@ -24,6 +24,8 @@ export default class UmbInputUploadFieldFileElement extends UmbLitElement { #serverUrl = ''; + #loadingText = `(${this.localize.term('general_loading')}...)`; + /** * */ @@ -37,8 +39,8 @@ export default class UmbInputUploadFieldFileElement extends UmbLitElement { protected override updated(_changedProperties: PropertyValueMap | Map): void { super.updated(_changedProperties); if (_changedProperties.has('file') && this.file) { - this.extension = this.#getExtensionFromMime(this.file.type) ?? ''; - this.label = this.file.name || 'loading...'; + this.extension = this.file.name.split('.').pop() ?? ''; + this.label = this.file.name || this.#loadingText; } if (_changedProperties.has('path')) { @@ -46,22 +48,11 @@ export default class UmbInputUploadFieldFileElement extends UmbLitElement { if (this.file) return; this.extension = this.path.split('.').pop() ?? ''; - this.label = this.#serverUrl ? this.path.substring(this.#serverUrl.length) : 'loading...'; + this.label = this.#serverUrl ? this.path.substring(this.#serverUrl.length) : this.#loadingText; } } } - #getExtensionFromMime(mime: string): string { - if (!mime) return ''; //folders - - const extension = mime.split('/')[1]; - if (extension === 'svg+xml') { - return 'svg'; - } else { - return extension; - } - } - #renderLabel() { if (this.path) { // Don't make it a link if it's a temp file upload.