[jira] [Commented] (CB-6053) DirectoryEntry.getFile() fails for relative paths

2014-02-18 Thread Stepan Riha (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-6053?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13904354#comment-13904354
 ] 

Stepan Riha commented on CB-6053:
-

All in JavaScript.  This is what my workaround looks like for the getFile 
method:

{code:title=FileProxy.js}
getFile:function(win,fail,args) {
var fullPath = args[0];
var path = args[1];
var options = args[2];

// Transfer leading directories from path to fullPath
path = path.replace(/\//g, "\\");
var idx = path.lastIndexOf("\\");
if (idx > 0) {
var dir = path.substr(0, idx);
fullPath = fullPath ? fullPath + "\\" + dir : dir;
path = path.substr(idx + 1);
}
...
{code}

Note that this code doesn't address the case where {{path}} is an absolute path 
(starting with {{'/'}}).  I'm not quite sure what the behavior should be in 
that case - but our code doesn't need support for it.

> DirectoryEntry.getFile() fails for relative paths
> -
>
> Key: CB-6053
> URL: https://issues.apache.org/jira/browse/CB-6053
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Plugin File, Windows 8
>Affects Versions: 3.3.0
> Environment: Windows 8
>Reporter: Stepan Riha
>Assignee: Ian Clelland
>
> According to the spec, DirectoryEntry.getFile() is supposed to support 
> specifying a relative path.  However, specifying a relative path (and 
> option.create=false) will cause the method to fail with 
> {{FileError.ENCODING_ERR}}.
> The culprit seems to be following code in FileProxy.getFile() - it tests for 
> invalid *file _name_* characters but should really be testing invalid *file 
> _path_* characters (i.e. it should allow {{/}}).
> {code:title=FileProxy.js}
> if (/\?|\\|\*|\||\"|<|>|\:|\//g.test(path)) {
> fail && fail(FileError.ENCODING_ERR);
> return;
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (CB-6053) DirectoryEntry.getFile() fails for relative paths

2014-02-18 Thread Stepan Riha (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-6053?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13904226#comment-13904226
 ] 

Stepan Riha commented on CB-6053:
-

FYI, it looks like the same issue affects the {{DirectoryEntry.getDirectory()}} 
method.  In both of these, leading directories in the {{path}} should be 
transferred to the end of the {{fullPath}} before calling 
{{Windows.Storage.StorageFolder.getFolderFromPathAsync(fullPath)}}.

Unless someone else wants to tackle this, I can fix the issues and submit a 
pull request.

> DirectoryEntry.getFile() fails for relative paths
> -
>
> Key: CB-6053
> URL: https://issues.apache.org/jira/browse/CB-6053
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Plugin File, Windows 8
>Affects Versions: 3.3.0
> Environment: Windows 8
>Reporter: Stepan Riha
>Assignee: Jesse MacFadyen
>
> According to the spec, DirectoryEntry.getFile() is supposed to support 
> specifying a relative path.  However, specifying a relative path (and 
> option.create=false) will cause the method to fail with 
> {{FileError.ENCODING_ERR}}.
> The culprit seems to be following code in FileProxy.getFile() - it tests for 
> invalid *file _name_* characters but should really be testing invalid *file 
> _path_* characters (i.e. it should allow {{/}}).
> {code:title=FileProxy.js}
> if (/\?|\\|\*|\||\"|<|>|\:|\//g.test(path)) {
> fail && fail(FileError.ENCODING_ERR);
> return;
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Created] (CB-6053) DirectoryEntry.getFile() fails for relative paths

2014-02-17 Thread Stepan Riha (JIRA)
Stepan Riha created CB-6053:
---

 Summary: DirectoryEntry.getFile() fails for relative paths
 Key: CB-6053
 URL: https://issues.apache.org/jira/browse/CB-6053
 Project: Apache Cordova
  Issue Type: Bug
  Components: Plugin File, Windows 8
Affects Versions: 3.3.0
 Environment: Windows 8
Reporter: Stepan Riha
Assignee: Jesse MacFadyen


According to the spec, DirectoryEntry.getFile() is supposed to support 
specifying a relative path.  However, specifying a relative path (and 
option.create=false) will cause the method to fail with 
{{FileError.ENCODING_ERR}}.

The culprit seems to be following code in FileProxy.getFile() - it tests for 
invalid *file _name_* characters but should really be testing invalid *file 
_path_* characters (i.e. it should allow {{/}}).
{code:title=FileProxy.js}
if (/\?|\\|\*|\||\"|<|>|\:|\//g.test(path)) {
fail && fail(FileError.ENCODING_ERR);
return;
}
{code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)