You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the filesystem mkdir command with the recursive argument and a 3 segments path (see example below), this raises the exception "Cannot create Root directory"
Expected Behavior
No exception
Code Reproduction
Just call this line in any capacitor web project :
This call gets the parent path of what is already the parent path. So basically, the mkdir function skips a level. If you have a folder with 3 segments, it goes directly from the 3 segments path to a 1 segment path, the function is never called with a depth of 2 (which is the recursive break condition), hence the exception.
The simple fix seem to use the already existing parentPath as is in the recursive call of mkdir, like this : mkdir_changed.txt
The text was updated successfully, but these errors were encountered:
Bug Report
Plugin(s)
filesystem 6.0.1
Capacitor Version
Platform(s)
Web
Current Behavior
When using the filesystem mkdir command with the recursive argument and a 3 segments path (see example below), this raises the exception "Cannot create Root directory"
Expected Behavior
No exception
Code Reproduction
Just call this line in any capacitor web project :
await Filesystem.mkdir({'path':/LIBRARY/A/B, recursive:true});
It's important that the folder path has at least 3 segments.
Other Technical Details
Additional Context
This is the current capacitor filesystem mkdir web function : mkdir_orig.txt
The issue seems to be with this line :
const parentArgPath = parentPath.substr(parentPath.indexOf('/', 1));
This call gets the parent path of what is already the parent path. So basically, the mkdir function skips a level. If you have a folder with 3 segments, it goes directly from the 3 segments path to a 1 segment path, the function is never called with a depth of 2 (which is the recursive break condition), hence the exception.
The simple fix seem to use the already existing parentPath as is in the recursive call of mkdir, like this : mkdir_changed.txt
The text was updated successfully, but these errors were encountered: