apache / apache/cordova-plugin-file
getParent returns always root directory
- Dominant language
- JavaScript
- Stars
- 744
- Forks
- 754
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 1
Description
# Bug Report
## Problem
`getParent()` returns always the root directory instead of the parent directory.
### What is expected to happen?
`getParent()` on directory `/documents/upload/foobar/` should return `/documents/upload/`
### What does actually happen?
`getParent()` return `/`
## Information
### Command or Code
https://github.com/apache/cordova-plugin-file/blob/master/src/windows/FileProxy.js#L553
```js
(new RegExp('/[^/]*/?$')).test(path)
```
is always true
### Environment, Platform, Device
UWP Windows 10 18362.449
### Version information
cordova: 8.1.2
cordova-windows: 6.0.1
cordova-plugin-file: 5.00
## Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
Contributor guide
Research direction
Start in src/windows/FileProxy.js around line 553 and inspect the getParent() path-matching logic. Reproduce the documented case with /documents/upload/foobar/ and verify that the result is /documents/upload/ rather than /. Done means the Windows implementation returns the immediate parent directory for nested paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100