[bug] "Join()" from @tauri-apps/api/path doesn't produce encoded path on Android
Describe the bug
so, the @tauri-apps/api/path function called join() is not joining android content uri stirng in an as an encoded string.
Example
// running in android
await join('Hello', 'Guyz');
// Result : Hello/Guyz
// Should be : Hello%2FGuyz
// %2F bieng the path seperator
Reproduction
- create a new tauri Project using vite
- choose vanilla option
- just add a button in frontend, onclick triggers the
join('Hello', 'Guyz')function from@tauri-apps/api/path - log the result and see in the android js console (eg through the
chrome://inspect/#devices)
Expected behavior
it should add a android seperator which is commonly set to %2F
Full tauri info output
[✔] Environment
- OS: Debian 12.0.0 x86_64 (X64) (Unknown DE on x11)
✔ webkit2gtk-4.1: 2.50.1
✔ rsvg2: 2.54.7
✔ rustc: 1.91.1 (ed61e7d7e 2025-11-07)
✔ cargo: 1.91.1 (ea2d97820 2025-10-10)
✔ rustup: 1.28.2 (e4f3ad6f8 2025-04-28)
✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
- node: 22.19.0
- npm: 10.9.3
- bun: 1.3.3
[-] Packages
- tauri 🦀: 2.9.4
- tauri-build 🦀: 2.5.3
- wry 🦀: 0.53.5
- tao 🦀: 0.34.5
- tauri-cli 🦀: 2.9.4 (outdated, latest: 2.9.5)
[-] Plugins
- tauri-plugin-dialog 🦀: 2.4.2
- tauri-plugin-store 🦀: 2.4.1
- tauri-plugin-log 🦀: 2.7.1
- tauri-plugin-os 🦀: 2.3.2
- tauri-plugin-fs 🦀: 2.4.4
[-] App
- build-type: bundle
- CSP: unset
- frontendDist: ../dist
- devUrl: http://localhost:5173/
Stack trace
Additional context
No response
do you have some non-tauri examples where path components are joined encoded like this? I'm still not too familiar with content uris or android as a whole but it sounds wrong to universally apply %2F instead of / here 🤔
do you have some non-tauri examples where path components are joined encoded like this? I'm still not too familiar with content uris or android as a whole but it sounds wrong to universally apply
%2Finstead of/here 🤔
Using %2F as a separator in a content URI occurs only in SAF URIs that refer to directories from certain file providers, such as standard local storage provider. These take the form content://<provider-name>/tree/<document-id>, and the %2F is used only in <document-id>, so it is not really path concatenation but more of a hack-like way of joining IDs. Also, the internal structure of a <document-id> is entirely up to the file provider, and there is no guarantee that it will support joining components with %2F. 😱
do you have some non-tauri examples where path components are joined encoded like this?
i unfortunately dont
I'm still not too familiar with content uris or android as a whole but it sounds wrong to universally apply %2F instead of / here 🤔
same for me, so i started a tauri project that requires a full file management machanism. and need to work on all platforms. so, i am very new to android and now that i think about it, yeah it seems wrong to have %2F as a universal seperator
it is not really path concatenation but more of a hack-like way of joining IDs. Also, the internal structure of a
<document-id>is entirely up to the file provider
thanks for the valueable information @aiueo13. greatly appriciated 👍
i think i don't have any other choice than to just %2F as a separator?
thanks for the valueable information @aiueo13. greatly appriciated 👍 i think i don't have any other choice than to just
%2Fas a separator?
The most appropriate approach is to perform an operation equivalent to readDir and recursively traverse entries to construct the URI. However, since this is bad for performance, it might be better to use %2F and percent-encoded file/directory name concatenation when dealing with certain file providers.🙂