Skip to content

V15: Upload Field should use a better file preview#18899

Merged
iOvergaard merged 1 commit intov15/devfrom
v15/bugfix/file-upload-file-preview-server
Apr 1, 2025
Merged

V15: Upload Field should use a better file preview#18899
iOvergaard merged 1 commit intov15/devfrom
v15/bugfix/file-upload-file-preview-server

Conversation

@iOvergaard
Copy link
Contributor

@iOvergaard iOvergaard commented Apr 1, 2025

Description

Fixes an issue where the serverUrl was shown twice and changes the component to use <uui-card-media /> instead.

Benefits include:

  • better href
  • no custom file symbols
  • better a11y
  • you can now see the filename

Screenshots

🔴 BEFORE
image

AFTER
image

…he component to use `<uui-card-media />` instead
Copilot AI review requested due to automatic review settings April 1, 2025 09:28
@iOvergaard iOvergaard enabled auto-merge (squash) April 1, 2025 09:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves the file preview in the upload field component by removing the duplicated server URL and replacing the previous preview with the component.

  • Removed server URL concatenation and obsolete state properties
  • Introduced private getters for label and file extension to drive the new card media component
Comments suppressed due to low confidence (1)

src/Umbraco.Web.UI.Client/src/packages/media/media/components/input-upload-field/preview/input-upload-field-file.element.ts:20

  • The fallback logic in the getter for #label may yield an empty string when this.path is defined but does not contain a valid file name, potentially causing a missing label in the preview. Consider adding explicit handling for such edge cases.
return this.path.split('/').pop() ?? `(${this.localize.term('general_loading')}...)`;

@iOvergaard iOvergaard merged commit d4acd53 into v15/dev Apr 1, 2025
24 checks passed
@iOvergaard iOvergaard deleted the v15/bugfix/file-upload-file-preview-server branch April 1, 2025 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants