Skip to content
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

Uncaught forbidden path error when using writeFile from @tauri-apps/plugin-fs #12704

Open
ProfNuru opened this issue Feb 14, 2025 · 0 comments
Open

Comments

@ProfNuru
Copy link

I am trying to save an image to disk and after trying several options, this is the closest I have gotten:

const uploadedFile = await writeFile(original_image.${extension}, bytes, { baseDir: BaseDirectory.AppLocalData, });

Basically, I read the uploaded image file as Uint8Array bytes and write it to AppLocalData. But this throws an error which says Uncaught forbidden path.

I added this to main.json in capabalities:
... "fs:default", { "identifier": "fs:allow-exists", "allow": [{ "path": "$APPDATA/*" }] }
I also have this set up in tauri.conf.json:
"assetProtocol": { "enable": true, "scope": { "allow": ["$APPDATA/**", "$RESOURCE/**", "$DOCUMENT/**"], "deny": ["$APPDATA/db/*.stronghold"] } }
I am open to any better way to save the image file. Thank you all in advanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant