Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 334B3200B7E for ; Mon, 22 Aug 2016 15:40:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 322D9160A91; Mon, 22 Aug 2016 13:40:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7B205160AB3 for ; Mon, 22 Aug 2016 15:40:21 +0200 (CEST) Received: (qmail 6465 invoked by uid 500); 22 Aug 2016 13:40:20 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 6397 invoked by uid 99); 22 Aug 2016 13:40:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Aug 2016 13:40:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 82BED2C0153 for ; Mon, 22 Aug 2016 13:40:20 +0000 (UTC) Date: Mon, 22 Aug 2016 13:40:20 +0000 (UTC) From: "Vladimir Kotikov (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (CB-9282) Plugin File for Android seems to require trailing slash to identify a directory MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 22 Aug 2016 13:40:22 -0000 [ https://issues.apache.org/jira/browse/CB-9282?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Vladimir Kotikov resolved CB-9282. ---------------------------------- Resolution: Fixed This seems to be fixed by this PR - [#167|https://github.com/apache/cordova-plugin-file/pull/167]. Closing as fixed > Plugin File for Android seems to require trailing slash to identify a directory > ------------------------------------------------------------------------------- > > Key: CB-9282 > URL: https://issues.apache.org/jira/browse/CB-9282 > Project: Apache Cordova > Issue Type: Bug > Components: Plugin File > Affects Versions: 2.1.0 > Reporter: Adriano Di Giovanni > Priority: Minor > Labels: Android > > Looking at LocalFileSystemURL.java, lines 39~55 > ```java > public static LocalFilesystemURL parse(Uri uri) { > if (!FILESYSTEM_PROTOCOL.equals(uri.getScheme())) { > return null; > } > String path = uri.getPath(); > if (path.length() < 1) { > return null; > } > int firstSlashIdx = path.indexOf('/', 1); > if (firstSlashIdx < 0) { > return null; > } > String fsName = path.substring(1, firstSlashIdx); > path = path.substring(firstSlashIdx); > boolean isDirectory = path.charAt(path.length() - 1) == '/'; > return new LocalFilesystemURL(uri, fsName, path, isDirectory); > } > ``` > I found that operations on urls like cdvfile://localhost/persistent (without trailing slash) don't work because firstSlashIds < 0. > Looking at line 53, Plugin file relies on trailing slash to know in advance if uri is a directory. > I can't find any mention of that in the docs. > I find that relying on trailing slashes to identify a directory imposes a burden for client code that must normalize all paths before calling any Plugin File function. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org For additional commands, e-mail: issues-help@cordova.apache.org