cordova-plugin-file icon indicating copy to clipboard operation
cordova-plugin-file copied to clipboard

getParent returns always root directory

Open JaegerJens opened this issue 6 years ago • 2 comments

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

(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

JaegerJens avatar Oct 25 '19 11:10 JaegerJens

Adding a leading ^to the pattern would fix the issue.

(new RegExp('^/[^/]*/?$')).test(path)

regnete avatar Feb 16 '21 11:02 regnete

Is there a better place to post issues than here?

regnete avatar Feb 16 '21 11:02 regnete