mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 02:48:13 -05:00
[PR #11520] [MERGED] Added decodeURIcomponent function to several locations. #22753
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/11520
Author: @icsy7867
Created: 3/10/2025
Status: ✅ Merged
Merged: 3/11/2025
Merged by: @tjbck
Base:
dev← Head:main📝 Commits (1)
3fb4776Added decodeURIcomponent function to several locations.📊 Changes
4 files changed (+8 additions, -8 deletions)
View changed files
📝
src/lib/components/chat/MessageInput/Commands/Knowledge.svelte(+1 -1)📝
src/lib/components/chat/Messages/Citations.svelte(+3 -3)📝
src/lib/components/chat/Messages/CitationsModal.svelte(+1 -1)📝
src/lib/components/common/FileItem.svelte(+3 -3)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
devbranch.Changelog Entry
Description
Creating a pull request to track my changes.
My initial discussion:
https://github.com/open-webui/open-webui/issues/11512
In my case, and I would think a lot of other folks, want to use a RAG to container their organizations Wiki documents, policies and other items. The current RAG API uses the file name as the document name (Though personally I think this should be able to be overwritten in the API as an optional field).
Ultimately, when the RAG returns a hit, the documentation location should not be a link to download the file, but a URL to the original document.
AS an example, I use the Confluence API to return the HTML bodies of every article in a space. I can then convert the HTML to raw text, and then upload to the RAG. But I want the to have a nice URL as a link in the open-webui chat GUI. However we run into an issue when we try to do this... a filename cannot container several of the characters found in a URL.
To overcome this, I have found that URL Encoding (Or percent encoding) is the easiest way to do this. Windows, linux and Macs can both save files using URLEncoded names. However this looks UGLY on the webgui side:
So by using the decodeURIcomponent javascript function, we can convert these display names. (However the original document names will remain the URL encoded values.)
Ultimately we have a nice clickable link!

If a filename does not container any sort of URLEncoded variables, the original string will be returned by this function.
Ultimately these percent encoded variables are the only strings that will be converted.
https://www.w3schools.com/tags/ref_urlencode.ASP
This could also be used if someone wanted an
FTP://link, or others:https://www.chromium.org/developers/design-documents/network-stack/#code-layout
This would also solved that issue.
Added
Added the javascript function decodeURIcomponent to a handful of places.
Changed
Deprecated
N/A
Removed
N/A
Fixed
N/A
Security
N/A
Breaking Changes
N/A
Additional Information
Screenshots or Videos
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.