Skip to content

Commit c021968

Browse files
authored
fix(core): asset loading not decoding percent-encoded path, closes #1879 (#1938)
1 parent 40b717e commit c021968

7 files changed

Lines changed: 13 additions & 4 deletions

File tree

.changes/fix-asset-loading.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch
3+
---
4+
5+
Fixes custom protocol asset loader not decoding the percent-encoded path.

core/tauri/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ http = "0.2"
5555
state = "0.4"
5656
bincode = "1.3"
5757
dirs-next = "2.0"
58+
percent-encoding = "2.1"
5859

5960
# FS
6061
base64 = { version = "0.13", optional = true } # also used on the updater

core/tauri/src/manager.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,9 @@ impl<P: Params> WindowManager<P> {
406406
if path.ends_with('/') {
407407
path.pop();
408408
}
409+
path = percent_encoding::percent_decode(path.as_bytes())
410+
.decode_utf8_lossy()
411+
.to_string();
409412
let path = if path.is_empty() {
410413
// if the url is `tauri://localhost`, we should load `index.html`
411414
"index.html".to_string()

examples/api/public/build/bundle.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/api/public/build/bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/api/src/App.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181

8282
<main>
8383
<div class="flex row noselect just-around" style="margin=1em;" data-tauri-drag-region>
84-
<img src="tauri.png" height="60" on:click={onLogoClick} alt="logo" />
84+
<img src="tauri logo.png" height="60" on:click={onLogoClick} alt="logo" />
8585
<div>
8686
<a class="dark-link" target="_blank" href="https://tauri.studio/en/docs/getting-started/intro">
8787
Documentation

0 commit comments

Comments
 (0)