mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-15 13:41:39 +03:00
This commit is contained in:
parent
b1f83fd05f
commit
42e8d9cf92
5
.changes/api-encode-protocol-path.md
Normal file
5
.changes/api-encode-protocol-path.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"api": patch
|
||||
---
|
||||
|
||||
Encode the file path in the `convertFileSrc` function.
|
@ -114,9 +114,10 @@ async function invoke<T>(cmd: string, args: InvokeArgs = {}): Promise<T> {
|
||||
* @return the URL that can be used as source on the webview.
|
||||
*/
|
||||
function convertFileSrc(filePath: string, protocol = 'asset'): string {
|
||||
const path = encodeURIComponent(filePath)
|
||||
return navigator.userAgent.includes('Windows')
|
||||
? `https://${protocol}.localhost/${filePath}`
|
||||
: `${protocol}://${filePath}`
|
||||
? `https://${protocol}.localhost/${path}`
|
||||
: `${protocol}://${path}`
|
||||
}
|
||||
|
||||
export type { InvokeArgs }
|
||||
|
Loading…
Reference in New Issue
Block a user