[
https://issues.apache.org/jira/browse/CB-10577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15180639#comment-15180639
]
ASF GitHub Bot commented on CB-10577:
-------------------------------------
GitHub user jasongin opened a pull request:
https://github.com/apache/cordova-plugin-file/pull/167
CB-10577: Android resolveLocalFileSystemURL should detect directory
@rakatyal or @riknoll please review
There were two places in the Android file plugin code that didn't do the
right thing when resolving a URI whose trailing slash didn't match the
directory vs file status.
1. In LocalFileSystem.toLocalUri(), the returned path should never have a
terminating slash if the path does not point to a directory.
2. In FileUtils.resolveLocalFileSystemUri(), resolving a cdvfile:// (aka
"local") URI now converts to native URI and back to a local URI (making use of
the change above) in order to force resolution of whether the path points to a
file or a directory and fix the terminating slash character accordingly. This
is only done for local URIs, because for native URIs the resolveNativeUri()
call would already have called toLocalUri() so doing it again would be
redundant in that case.
I added automated test cases for resolving native URI files and directories
using mismatched trailing slashes. As for cdvfile:// URIs, we currently only
have manual test cases for those (at the bottom of tests.js) and they aren't
very thorough. I manually tested this fix with cdvfile:// URIs.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/jasongin/cordova-plugin-file CB-10577
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cordova-plugin-file/pull/167.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #167
----
commit 89ccaf2d4c3b2ffbdbdc79804238c083ce9f2c30
Author: Jason Ginchereau <[email protected]>
Date: 2016-03-04T20:02:10Z
CB-10577: Android resolveLocalFileSystemURL should detect directory vs file
----
> Android plugin file: resolveLocalFileSystemURL produce incorrect value
> ----------------------------------------------------------------------
>
> Key: CB-10577
> URL: https://issues.apache.org/jira/browse/CB-10577
> Project: Apache Cordova
> Issue Type: Bug
> Components: Plugin File
> Reporter: vldmrrrr
> Priority: Critical
> Labels: android, triaged
> Attachments: index.js
>
>
> On android resolveLocalFileSystemURL sets isDirectory and isFile properties
> based on argument URL having trailing slash, and not on actual object type.
> See attached test program, which currently outputs the following:
> cdvfile://localhost/temporary/tst is file
> cdvfile://localhost/temporary/tst/ is directory
> Correct output shall be:
> cdvfile://localhost/temporary/tst is directory
> cdvfile://localhost/temporary/tst/ is directory
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]