fix: Implement file sharing password processing and remote download file name processing - #13452
fix: Implement file sharing password processing and remote download file name processing#13452lan-yonghui wants to merge 1 commit into
Conversation
…ile name processing
There was a problem hiding this comment.
🟡 Not ready to approve
The share page currently clears the entire URL hash after reading the password, which can unintentionally drop other hash parameters/fragments; it should remove only the password key.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR improves public file-sharing and remote download UX by (1) allowing share passwords to be embedded/extracted via the URL hash on the public share page, and (2) improving filename extraction for remote downloads (wget) with more robust URL parsing.
Changes:
- Add file-share password propagation: append password to shared links (hash) and auto-apply it on the public share page.
- Improve remote download filename parsing by using a dedicated URL/Content-Disposition-aware helper.
- Centralize “public file share API” path detection in backend middleware and reuse it for proxy/session/password-expiration gating.
File summaries
| File | Description |
|---|---|
| frontend/src/views/share/index.vue | Auto-reads share password from URL hash and applies it before checking/downloading. |
| frontend/src/views/host/file-management/wget/index.vue | Uses a new helper to derive a safer/more accurate filename from a URL. |
| frontend/src/views/host/file-management/share/index.vue | Uses a helper to copy share links that include password in the hash. |
| frontend/src/utils/file.ts | Adds URL filename extraction utilities and file-share password hash helpers. |
| core/middleware/password_expired.go | Exempts public share endpoints from password-expiration checks. |
| core/middleware/helper.go | Introduces IsPublicFileShareAPI for shared backend checks. |
| core/init/router/proxy.go | Reuses middleware IsPublicFileShareAPI and removes local duplicate logic. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 1
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
| const applySharedPassword = () => { | ||
| const sharedPassword = getFileSharePasswordFromHash(window.location.hash); | ||
| if (!sharedPassword) { | ||
| return; | ||
| } | ||
| password.value = sharedPassword; | ||
| window.history.replaceState(window.history.state, '', `${window.location.pathname}${window.location.search}`); | ||
| }; |
#13440
#13366