feat(core): add convert_file_src() — Rust equivalent of convertFileSrc()#14951
Closed
omair445 wants to merge 1 commit intotauri-apps:devfrom
Closed
feat(core): add convert_file_src() — Rust equivalent of convertFileSrc()#14951omair445 wants to merge 1 commit intotauri-apps:devfrom
omair445 wants to merge 1 commit intotauri-apps:devfrom
Conversation
Adds a public convert_file_src() function to the tauri crate that converts
local file paths to asset protocol URLs, matching the behavior of the
existing JavaScript convertFileSrc() function.
On Windows/Android: https://{protocol}.localhost/{encoded_path}
On other platforms: {protocol}://localhost/{encoded_path}
Closes tauri-apps#12022
Author
|
Hey everyone, I am very very sorry I got stuck in work-related stuff and haven't been able to follow up on this. I am happy if anyone else can take care of this from here or if the maintainers want to push the final bits. Apologies again for the delay! |
Contributor
|
Hey, thanks for contributing. I am closing this since someone's already working on this at #14786 and the review is in progress |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey! I noticed there's no Rust-side equivalent of the JS
convertFileSrc()function, so I went ahead and added one.What this does
Adds a public
tauri::convert_file_src()function that converts a local file path into an asset protocol URL that can be loaded by the webview. This mirrors the existing JavaScriptconvertFileSrc()behavior:https://{protocol}.localhost/{encoded_path}{protocol}://localhost/{encoded_path}Usage
This is useful for Rust plugin authors and app developers who need to construct asset URLs from the backend without going through JS.
Closes #12022