Răsfoiți Sursa

fix(core): asset loading not decoding percent-encoded path, closes #1879 (#1938)

Lucas Fernandes Nogueira 4 ani în urmă
părinte
comite
c021968eb8

+ 5 - 0
.changes/fix-asset-loading.md

@@ -0,0 +1,5 @@
+---
+"tauri": patch
+---
+
+Fixes custom protocol asset loader not decoding the percent-encoded path.

+ 1 - 0
core/tauri/Cargo.toml

@@ -55,6 +55,7 @@ http = "0.2"
 state = "0.4"
 bincode = "1.3"
 dirs-next = "2.0"
+percent-encoding = "2.1"
 
 # FS
 base64 = { version = "0.13", optional = true } # also used on the updater

+ 3 - 0
core/tauri/src/manager.rs

@@ -406,6 +406,9 @@ impl<P: Params> WindowManager<P> {
         if path.ends_with('/') {
           path.pop();
         }
+        path = percent_encoding::percent_decode(path.as_bytes())
+          .decode_utf8_lossy()
+          .to_string();
         let path = if path.is_empty() {
           // if the url is `tauri://localhost`, we should load `index.html`
           "index.html".to_string()

Fișier diff suprimat deoarece este prea mare
+ 0 - 0
examples/api/public/build/bundle.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
examples/api/public/build/bundle.js.map


+ 0 - 0
examples/api/public/tauri.png → examples/api/public/tauri logo.png


+ 1 - 1
examples/api/src/App.svelte

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

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff