-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] Unhandled Promise Rejection for $TEMP: path not allowed on the configured scope #6256
Comments
I have the same problem scope: {
"$TEMP/AMCL",
"$TEMP/AMCL/**"
} code: const tempDir = await resolve(await tempdir(), 'AMCL')
if (!(await exists(tempDir))) await createDir(tempDir) error: Uncaught (in promise) path not allowed on the configured scope: C:\Users\zhenxin\AppData\Local\Temp\AMCL tauri info: Environment
› OS: Windows 10.0.22621 X64
› Webview2: 110.0.1587.56
› MSVC:
- Visual Studio ���ɹ��� 2022
› Node.js: 18.13.0
› npm: Not installed!
› pnpm: 7.27.1
› yarn: Not installed!
› rustup: 1.25.2
› rustc: 1.67.1
› cargo: 1.67.1
› Rust toolchain: stable-x86_64-pc-windows-msvc
Packages
› @tauri-apps/cli [NPM]: 1.2.3
› @tauri-apps/api [NPM]: tauri-apps
› tauri [RUST]: 1.2.4,
› tauri-build [RUST]: 1.2.1,
› tao [RUST]: 0.15.8,
› wry [RUST]: 0.23.4,
App
› framework: Vue.js
› bundler: Vite
App directory structure
├─ .git
├─ .github
├─ .vscode
├─ dist
├─ node_modules
├─ public
├─ scripts
├─ src
└─ src-tauri |
I'm sure the problem happens because on MacO std::env::temp_dir() returns path starting with /var, but /var is a symbolic link to /private/var. I took a look at the source code and I don't see any canonicalization of paths parsed from config. But we canonicalize paths received from API. The tokenizer then compares /var/... to /private/var/.., which of course is not a match. |
I have the same issue on windows. None of the following work only wildcard does.
Is there atleast a workournd for this other than using wildcard and exposing the whole filesystem? |
I am using macOS as well, and the same issue is troubling me. |
Also ran into this trying to write a temp file: await fs.writeBinaryFile(name, contents, {
dir: fs.BaseDirectory.Temp,
}); Gives
Any idea if this can be patched? |
Take a look at the source code tauri/core/tauri/src/scope/fs.rs Lines 68 to 85 in caddd5b
When adding a permission pattern, it will try to canonicalize the path only on Windows. tauri/core/tauri/src/scope/fs.rs Lines 229 to 236 in caddd5b
When checking permissions, the first time called |
Describe the bug
The problem occurs when opening a file from the
BaseDirectory.Temp
. Other directories work.I tried different configurations, the only one that works is a wildcard.
Reproduction
I created a repository for reproduction: https://github.com/gormlabenz/tauri-temp-bug
"$TEMP/**"
to scopeExpected behavior
Shouldn't fail when opening file from
BaseDirectory.Temp
Platform and versions
Environment
› OS: Mac OS 13.1.0 X64
› Node.js: 16.15.0
› npm: 9.3.1
› pnpm: 7.27.0
› yarn: 1.22.19
› rustup: 1.25.1
› rustc: 1.63.0
› cargo: 1.63.0
› Rust toolchain: stable-x86_64-apple-darwin
Packages
› @tauri-apps/cli [NPM]: 1.2.3
Stack trace
Additional context
No response
The text was updated successfully, but these errors were encountered: