Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): AssetResolver.get(): don't skip first char #12971

Merged
merged 1 commit into from
Mar 14, 2025

Conversation

WofWca
Copy link
Contributor

@WofWca WofWca commented Mar 13, 2025

That is, it would try to get sers/john if you called
AssetResolver.get("users/john").
This commit fixes the bug by only skipping the first character
only if it is a slash (/).

Why it is important:
tauri::WebviewUrl::App() docs state that it's OK to specify
the path as users/john to get tauri://localhost/users/john
in the end.
So if an application developer is using AssetResolver.get()
together with WebviewUrl::App(), they will would get
inconsistent behavior: for the same path, the latter would work,
while the former would fail.
In fact, we encountered this bug in our code,
here.

Verified

This commit was signed with the committer’s verified signature.
rafaelfranca Rafael Mendonça França
That is, it would try to get `sers/john` if you called
`AssetResolver.get("users/john")`.
This commit fixes the bug by only skipping the first character
only if it _is_ a slash (/).

Why it is important:
`tauri::WebviewUrl::App()` docs state that it's OK to specify
the path as `users/john` to get `tauri://localhost/users/john`
in the end.
So if an application developer is using `AssetResolver.get()`
together with `WebviewUrl::App()`, they will would get
inconsistent behavior: for the same path, the latter would work,
while the former would fail.
In fact, we encountered this bug in our code,
[here](https://github.com/deltachat/deltachat-desktop/blob/c860b0f4c659cdb0659ba946ecdd7f0381792946/packages/target-tauri/src-tauri/src/help_window.rs#L34-L43).
@WofWca WofWca marked this pull request as ready for review March 13, 2025 20:29
@WofWca WofWca requested a review from a team as a code owner March 13, 2025 20:29
Copy link
Contributor

Package Changes Through 50895ee

There are 6 changes which include tauri with minor, @tauri-apps/api with minor, tauri-runtime-wry with minor, tauri-bundler with patch, tauri-cli with patch, @tauri-apps/cli with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
@tauri-apps/api 2.3.0 2.4.0
tauri-bundler 2.2.4 2.2.5
tauri-runtime-wry 2.4.1 2.5.0
tauri 2.3.1 2.4.0
@tauri-apps/cli 2.3.1 2.3.2
tauri-cli 2.3.1 2.3.2

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@amrbashir amrbashir merged commit f67a4a6 into tauri-apps:dev Mar 14, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🔎 In audit
Development

Successfully merging this pull request may close these issues.

None yet

2 participants