From aad1202d5ec4194f767d734d63049ef445bd1b31 Mon Sep 17 00:00:00 2001
From: yuyx <237899745@qq.com>
Date: Tue, 17 Feb 2026 22:54:12 +0800
Subject: [PATCH] ui: show file names instead of full paths in shares
---
frontend/app.html | 10 +++++-----
frontend/app.js | 14 ++++++++++++++
2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/frontend/app.html b/frontend/app.html
index 17d2359..8ea6eb1 100644
--- a/frontend/app.html
+++ b/frontend/app.html
@@ -2985,7 +2985,7 @@
- {{ share.share_path }}
+ {{ getPathBaseName(share.share_path) }}
@@ -3032,7 +3032,7 @@
- | 文件路径 |
+ 文件名 |
链接地址 |
访问次数 |
下载次数 |
@@ -3042,7 +3042,7 @@
- | {{ share.share_path }} |
+ {{ getPathBaseName(share.share_path) }} |
{{ share.share_url }}
|
@@ -3090,7 +3090,7 @@
- | 文件路径 |
+ 文件名 |
链接地址 |
访问次数 |
下载次数 |
@@ -3100,7 +3100,7 @@
- | {{ link.file_path }} |
+ {{ getPathBaseName(link.file_path, link.file_name) }} |
{{ link.direct_url }}
|
diff --git a/frontend/app.js b/frontend/app.js
index ab98a7d..02bffa8 100644
--- a/frontend/app.js
+++ b/frontend/app.js
@@ -2702,6 +2702,20 @@ handleDragLeave(e) {
return normalized.startsWith('/') ? normalized : `/${normalized}`;
},
+ getPathBaseName(pathValue, preferredName = '') {
+ if (typeof preferredName === 'string' && preferredName.trim()) {
+ return preferredName.trim();
+ }
+
+ const normalized = this.normalizeSharePath(pathValue || '/');
+ if (normalized === '/') {
+ return '/';
+ }
+
+ const segments = normalized.split('/').filter(Boolean);
+ return segments.length > 0 ? segments[segments.length - 1] : '/';
+ },
+
isShareAllFiles(share) {
if (!share) return false;
const shareType = share.share_type || 'file';