apache / cordova-plugin-file

Apache Cordova File Plugin
https://cordova.apache.org/
Apache License 2.0
742 stars 761 forks source link

getParent returns always root directory #354

Open JaegerJens opened 5 years ago

JaegerJens commented 5 years ago

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

regnete commented 3 years ago

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

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

regnete commented 3 years ago

Is there a better place to post issues than here?