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

[bug] IPC fails in non-http protocol windows #11504

Open
luoffei opened this issue Oct 27, 2024 · 0 comments
Open

[bug] IPC fails in non-http protocol windows #11504

luoffei opened this issue Oct 27, 2024 · 0 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@luoffei
Copy link
Contributor

luoffei commented Oct 27, 2024

Describe the bug

When a window is created using a non-http protocol (data:text/html,) the value of Origin is empty when calling the rust backend command. However, Origin is required when parsing the call request.

let url = Url::parse(
parts
.headers
.get("Origin")
.ok_or("missing Origin header")?
.to_str()
.map_err(|_| "Origin header value must be a string")?,
)
.map_err(|_| "Origin header is not a valid URL")?;

Reproduction

Create a window using a non-http protocol (data:text/html,)

let data_url = Url::parse("data:text/plain,Hello?World#").unwrap();
let _ = tauri::WebviewWindowBuilder::new(&app_handle, "example", tauri::WebviewUrl::CustomProtocol(data_url)).build();

Then the front end calls the rust backend command

const {open} = window.__TAURI__.shell;
open("https://github.com");

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.22635 x86_64 (X64)
    ✔ WebView2: 130.0.2849.52
    ✔ MSVC: Visual Studio Community 2022
    ✔ rustc: 1.82.0 (f6e511eec 2024-10-15)
    ✔ cargo: 1.82.0 (8f40fc59f 2024-08-21)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (environment override by RUSTUP_TOOLCHAIN)
    - node: 16.20.2
    - pnpm: 8.14.0
    - npm: 8.19.4

[-] Packages
    - tauri 🦀: 2.0.6
    - tauri-build 🦀: 2.0.2
    - wry 🦀: 0.46.2
    - tao 🦀: 0.30.3
    - tauri-cli 🦀: 2.0.1

[-] Plugins
    - tauri-plugin-fs 🦀: 2.0.2
    - tauri-plugin-autostart 🦀: 2.0.1
    - tauri-plugin-shell 🦀: 2.0.2
    - tauri-plugin-process 🦀: 2.0.1
    - tauri-plugin-single-instance 🦀: 2.0.1
    - tauri-plugin-notification 🦀: 2.0.1
    - tauri-plugin-http 🦀: 2.0.2

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../ui/dist
    - devUrl: http://localhost:8081/

Stack trace

No response

Additional context

No response

@luoffei luoffei added status: needs triage This issue needs to triage, applied to new issues type: bug labels Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

1 participant