Repository navigation
fix(ios): writeFile/stat in Directory.Temporary failing with OS-PLUG-FILE-0006 - #94
Merged
Merged
Conversation
resolveURL used try?, so any failure (e.g. pathEscapesDirectory) was reported as a bare 'Invalid path' (OS-PLUG-FILE-0006). Keep the code, append the underlying reason.
2.0.1 fixes writing new files to Directory.Temporary (and stat on missing files there) failing with OS-PLUG-FILE-0006 since the native containment check added in 1.1.4. Pin the exact version so a plugin release maps to one native lib version and native regressions can't reach apps through a fresh pod/SPM resolve. Closes #90
OS-pedrogustavobilro
approved these changes
Oct 14, 2026
OS-pedrogustavobilro
left a comment
Contributor
There was a problem hiding this comment.
LGTM. A reminder that we should update the cordova plugin with equivalent changes, and either release it for OutSystems. Or create a task for that so that it doesn't get lost and gets picked up whenever possible.
Contributor
Author
|
Thanks! Created RMET-5536 to port this and release it for OutSystems. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #90.
Problem
Since
IONFilesystemLib1.1.4, on iOS deviceswriteFileto a new file inDirectory.Temporaryfails withOS-PLUG-FILE-0006(andstaton a missing file there returns0006instead of0008). Root cause and fix are in the native lib: ionic-team/ion-ios-filesystem#20, released as 2.0.1.Changes
IONFilesystemLibto exactly2.0.1(podspec'2.0.1', Package.swiftexact: "2.0.1"). Exact instead of~>/fromso a plugin version maps to one native lib version, and a native regression can't reach apps through a fresh pod/SPM resolve without a plugin release (which is how 1.1.4 reached 8.1.2/8.1.3 users). See the discussion in fix: containment check rejects not-yet-created files in Directory.Temporary ion-ios-filesystem#20.FilesystemLocationResolver.resolveURLusedtry?, so anygetFileURLfailure was a bareInvalid '<path>' path.The code is unchanged (0006); the message now appends the underlying reason, e.g.Invalid 'x' path: Resolved path '...' is outside of directory '...'.This is what hid the cause of bug(ios): writeFile to Directory.Temporary fails with OS-PLUG-FILE-0006 since IONFilesystemLib 1.1.4 #90.Verification (iPhone 16 Pro Max, iOS 27.0.1, example app)
The bug doesn't reproduce on the simulator (its
tmp/has no/privatealias), so this was run on a device. TheIONFilesystemLibbinary in the app was checked (Mach-O UUID) against each build.Directory.Temporarystat00060008(does not exist) ✅writeFile0006, nothing intmp/tmp/✅writeFileto../../escape.txtWith 2.0.0, the new message shows the real cause:
Invalid 'repro90-….txt' path: Resolved path '/private/var/mobile/…/tmp/repro90-….txt' is outside of directory '/var/mobile/…/tmp/'.SPM:
swift package resolvepicks 2.0.1 andxcodebuild -scheme CapacitorFilesystembuilds.Note for upgrading apps
As with any native lib bump, apps with an existing
Podfile.lockwill getCocoaPods could not find compatible versions for pod "IONFilesystemLib"onnpx cap syncuntil they runpod update IONFilesystemLib(orpod install --repo-update).