dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

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

Open ealmloff opened this issue 1 year ago • 3 comments

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:

  • Find an absolute path to an image on windows
  • Use an image element: `img { src: "yourpath" } (where yourpath is on a different drive on windows)
  • Run the app

Expected behavior

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

Environment:

  • Dioxus version: master
  • Rust version: nightly
  • OS info: Windows
  • App platform: desktop

Questionnaire

  • [ ] I'm interested in fixing this myself but don't know where to start
  • [ ] I would like to fix and I have a solution
  • [ ] I don't have time to fix this right now, but maybe later

ealmloff avatar Jan 11 '24 19:01 ealmloff

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

ealmloff avatar Jan 11 '24 19:01 ealmloff

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.

jkelleyrtp avatar Jul 26 '24 21:07 jkelleyrtp

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

daixiwen avatar Aug 11 '24 19:08 daixiwen