tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
82.7k stars 2.48k forks source link

[bug] load image file by asset protocol from smb will hang the entire application. #7434

Open a1156883061 opened 1 year ago

a1156883061 commented 1 year ago

Describe the bug

I am using convertFileSrc to load local file, the app run properly when I load file from local disk. But if I load file from remote source, it will hang the entire application until the file loaded. I load file by smb protocol, path like this \\home.haoyuanlord.net\media\pexels-roberto-nickson-2559941.jpg this will be obvious when load 100mb+ files at the same time. file load not just hang current window, other windows also were freezed, so I think maybe the rust-end was blocked.

Reproduction

reproduction repo

Expected behavior

the app run normally when load the image files

Platform and versions

[✔] Environment
    - OS: Windows 10.0.22621 X64
    ✔ WebView2: 114.0.1823.82
    ✔ MSVC: Visual Studio ���ɹ��� 2019
    ✔ rustc: 1.66.0 (69f9c33d7 2022-12-12)
    ✔ Cargo: 1.66.0 (d65d197ad 2022-11-15)
    ✔ rustup: 1.25.1 (bb60b1e89 2022-07-12)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 18.12.1
    - pnpm: 8.6.7
    - yarn: 3.6.1
    - npm: 8.19.2

[-] Packages
    - tauri [RUST]: 1.4.1
    - tauri-build [RUST]: 1.4.0
    - wry [RUST]: 0.24.3
    - tao [RUST]: 0.16.2
    - @tauri-apps/api [NPM]: 1.4.0
    - @tauri-apps/cli [NPM]: 1.4.0

[-] App
    - build-type: bundle
    - CSP: default-src 'self'; img-src 'self' asset: https://asset.localhost
    - distDir: ../dist
    - devPath: http://localhost:1420/
    - framework: Vue.js
    - bundler: Vite

Stack trace

No response

Additional context

No response

amrbashir commented 1 year ago

your reproduction contains links that are not accessible on my machine, and I am not sure what are these links are supposed to be, so I'd appreciate if give a bit more explanation and properly add instructions on how to reproduce the bug and how to re-create your links on my machine.

a1156883061 commented 1 year ago

maybe you can search smb first. \\home.haoyuanlord.net\media\pexels-roberto-nickson-2559941.jpg, this is a smb link and only can access by local network. Sorry I don't have a Internet link for you. You can share folder on win, just right click a folder and chose to share. Then you can visit it on another win PC in local network. by the way, I shared these file on a linux server.

a1156883061 commented 1 year ago

maybe other file share protocol have the same BUG? Like FTP, WebDAV, and NFS. may you try these if you can't try smb.

amrbashir commented 1 year ago

I see, I haven't used SMB before so the url structure caught me off guard. what if you used it without convertFileSrc? does it work?

I think our internal file server is only meant from local disk and doesn't account for ftp/smb or another protocol because it is assumed to be a local path. I will see what I can do in this regard but let see if it works for you without convertFileSrc first.

a1156883061 commented 1 year ago

though it is a file shared by smb, but you can access it like the file on local disk. I maped the folder on E:, and the file path could be E:\\example\some.jpg, so i can't load it without convertFileSrc. for application the path is E:\\example\some.jpg, but in fact, the path is \smbpath\example\some.jpg in real application, I choose file from file dialog first and then load it.

a1156883061 commented 1 year ago

image image this is a example

amrbashir commented 1 year ago

thanks, this info is enough, I will see what I can do and get back to you.