From 4817585b668f8e6917aa6aefb3df2791fd2a288c Mon Sep 17 00:00:00 2001 From: Prakash Date: Sat, 29 Nov 2025 01:25:12 +0530 Subject: [PATCH] @uppy/companion: fix broken icons for webdav provider (#6069) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes #6063. It should be merged after #6059. Icon issue was fixed but This still doesn’t fix the thumbnail preview issue, because OwnCloud and Nextcloud don’t provide enough information about their thumbnail preview endpoints. The docs aren’t very helpful: they mention how to make a `PROPFIND` request to get extra metadata (such as has_preview) [doc_ref](https://docs.nextcloud.com/server/stable/developer_manual/client_apis/WebDAV/basic.html#requesting-properties), but I couldn’t get it to work with our webdav client. Even if we did manage to obtain the thumbnail preview URL, it would be a complicated capability to add, since we’d have to handle each WebDAV server separately. That would lead to the same problems discussed here: https://github.com/transloadit/uppy/pull/6059#issuecomment-3564642795 , so I don't think we need to spend anymore time on this. **Before** image **After** image --- .changeset/proud-tables-glow.md | 7 +++++++ .../@uppy/companion/src/server/provider/webdav/index.js | 9 +++++++++ packages/@uppy/core/src/_common.scss | 6 ++++++ .../provider-views/src/Item/components/ListItem.tsx | 8 ++++++-- 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 .changeset/proud-tables-glow.md diff --git a/.changeset/proud-tables-glow.md b/.changeset/proud-tables-glow.md new file mode 100644 index 000000000..2e910b00d --- /dev/null +++ b/.changeset/proud-tables-glow.md @@ -0,0 +1,7 @@ +--- +"@uppy/provider-views": patch +"@uppy/companion": patch +"@uppy/core": patch +--- + +added icon to webdav provider, add css to truncate large file names diff --git a/packages/@uppy/companion/src/server/provider/webdav/index.js b/packages/@uppy/companion/src/server/provider/webdav/index.js index 97c881c1c..391ec6f51 100644 --- a/packages/@uppy/companion/src/server/provider/webdav/index.js +++ b/packages/@uppy/companion/src/server/provider/webdav/index.js @@ -115,8 +115,17 @@ export default class WebdavProvider extends Provider { // ignore invalid date from server } + // Determine icon based on type and MIME type + let icon = 'file' + if (isFolder) { + icon = 'folder' + } else if (item.mime?.startsWith('video/')) { + icon = 'video' + } + data.items.push({ isFolder, + icon, id: requestPath, name: item.basename, modifiedDate, diff --git a/packages/@uppy/core/src/_common.scss b/packages/@uppy/core/src/_common.scss index 315ae8033..4ee9e32fb 100644 --- a/packages/@uppy/core/src/_common.scss +++ b/packages/@uppy/core/src/_common.scss @@ -49,6 +49,12 @@ text-align: right; } +.uppy-truncate-text { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + // Inputs .uppy-c-textInput { diff --git a/packages/@uppy/provider-views/src/Item/components/ListItem.tsx b/packages/@uppy/provider-views/src/Item/components/ListItem.tsx index 225c57f8d..4522644f2 100644 --- a/packages/@uppy/provider-views/src/Item/components/ListItem.tsx +++ b/packages/@uppy/provider-views/src/Item/components/ListItem.tsx @@ -75,7 +75,7 @@ export default function ListItem({ {showTitles && file.data.name ? ( - {file.data.name} + {file.data.name} ) : ( i18n('unnamed') )} @@ -89,7 +89,11 @@ export default function ListItem({
- {showTitles && (file.data.name ?? i18n('unnamed'))} + {showTitles && ( + + {file.data.name ?? i18n('unnamed')} + + )} )}