dify - ✅(Solved) Fix fix(web): clean upload filenames parsed from URLs [2 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langgenius/dify#35692Fetched 2026-04-30 06:45:34
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
1
Participants
Timeline (top)
cross-referenced ×2

Fix Action

Fixed

PR fix notes

PR #35657: fix(web): clean filenames parsed from URLs

Description (problem / solution / changelog)

Summary

  • Related to #35692.
  • Strip query strings and hash fragments when deriving upload filenames from URLs
  • Decode percent-encoded filename segments while preserving malformed input
  • Add coverage for signed/fragmented URLs and encoded filenames

Tests

  • cd web && corepack pnpm test app/components/base/file-uploader/__tests__/utils.spec.ts
  • corepack pnpm exec eslint web/app/components/base/file-uploader/utils.ts web/app/components/base/file-uploader/__tests__/utils.spec.ts

Changed files

  • web/app/components/base/file-uploader/__tests__/utils.spec.ts (modified, +10/-0)
  • web/app/components/base/file-uploader/utils.ts (modified, +11/-2)

PR #35706: fix: Clean upload filenames parsed from URLs

Description (problem / solution / changelog)

Summary

Fixed filename extraction from file upload URLs to properly handle query strings, hash fragments, signed URL parameters, and percent-encoded path segments. The derived filename now correctly contains only the clean basename without URL metadata.

Related issue

Fixes: #35692

Problem

When a file upload URL contains:

  • Query strings (e.g., ?signature=abc&expires=123)
  • Hash fragments (e.g., #section)
  • Signed URL parameters (e.g., AWS S3 presigned URLs)
  • Percent-encoded filename segments (e.g., %20 for spaces)

The derived filename could include URL metadata instead of the clean basename.

Technical Details

  • URL Parsing: Uses urllib.parse.urlparse() to separate path from query and fragment
  • Percent Decoding: Uses urllib.parse.unquote() with errors="replace" for safe fallback
  • Backward Compatible: Existing tests continue to pass; function accepts both full URLs and bare paths

Changed files

  • api/controllers/common/helpers.py (modified, +2/-1)
  • api/factories/file_factory/remote.py (modified, +14/-4)
  • api/tests/unit_tests/factories/test_file_factory.py (modified, +61/-0)
RAW_BUFFERClick to expand / collapse

Problem

When a file upload URL contains query strings, hash fragments, signed URL parameters, or percent-encoded filename segments, the derived filename can include URL metadata instead of the clean basename.

Expected behavior

Filename extraction should strip query strings and hash fragments, decode valid percent-encoded path segments, and preserve malformed input safely.

Related PR

Related to #35657

extent analysis

TL;DR

Update the filename extraction logic to properly handle URL metadata and percent-encoded filename segments.

Guidance

  • Review the current filename extraction implementation to identify where URL metadata is being included in the derived filename.
  • Consider using a URL parsing library to correctly handle query strings, hash fragments, and percent-encoded path segments.
  • Verify that the updated implementation preserves malformed input safely and correctly decodes valid percent-encoded filename segments.
  • Check the related PR #35657 for potential solutions or insights into the issue.

Example

No code snippet is provided due to lack of specific implementation details.

Notes

The solution may require adjustments based on the specific programming language and libraries used in the project.

Recommendation

Apply workaround: Update the filename extraction logic to correctly handle URL metadata and percent-encoded filename segments, as this is a more targeted approach to resolving the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Filename extraction should strip query strings and hash fragments, decode valid percent-encoded path segments, and preserve malformed input safely.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

dify - ✅(Solved) Fix fix(web): clean upload filenames parsed from URLs [2 pull requests, 1 participants]