DioxusLabs / dioxus

Fullstack app framework for web, desktop, mobile, and more.
https://dioxuslabs.com
Apache License 2.0
21.43k stars 826 forks source link

C:// and file:// paths are rejected by the webview #1814

Open ealmloff opened 10 months ago

ealmloff commented 10 months ago

Problem

If you use an absolute path on dioxus desktop on windows, it will be blocked by the webview and the asset will not resolve.

Steps To Reproduce

Steps to reproduce the behavior:

Expected behavior

Dioxus should either provide a different way to link to absolute paths on windows or fix absolute paths

Environment:

Questionnaire

ealmloff commented 10 months ago

Using dioxus://Drive:/yourassetpath also doesn't work because the custom wry protocol only receives the url after the drive, so we cannot find the asset the user wants

jkelleyrtp commented 3 months ago

Looked into this - the real problem is that when passing a path that includes the drive, the webview just rejects it

Not allowed local resource

We could/should provide some way of accessing off-drive paths - either via dioxus:// and some custom encoding or some other solution.

daixiwen commented 2 months ago

The correct way of specifying an URL with a custom protocol with wry on Windows is http://protocol.path So for example this will work: http://dioxus.c/Users/MyUser/Desktop/myimage.png. It's annoying to have to do it in a different way between linux and Windows, but it works. I'm not sure whether this is wry or Webview2's fault