commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernd Eckenfels (JIRA)" <>
Subject [jira] [Updated] (VFS-376) SFTP uri is throwing error when .. is using in path
Date Thu, 01 May 2014 23:22:15 GMT


Bernd Eckenfels updated VFS-376:

    Priority: Minor  (was: Blocker)

> SFTP uri is throwing error when .. is using in path
> ---------------------------------------------------
>                 Key: VFS-376
>                 URL:
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Ajesh babu
>            Priority: Minor
>              Labels: patch
>   Original Estimate: 3h
>  Remaining Estimate: 3h
> Hi
> We are using apache commons vfs2 for sftp file upload & download , but in one scenario
it is always giving an error like
> "SEVERE: FileSystemException ->org.apache.commons.vfs2.FileSystemException: Invalid
absolute URI "
> The uri is like "sftp://sftpuser:{AFF12398KYUJN982FGTB}@"
> The user home directory of sftpuser is 'app/utenti/sftpuser' , we want to use another
directory which is not under app/utenti/sftpuser, so we tried to traverse the parent directory
using ../../ but UriParser:normalisePath() method is always giving error ,
> in the below code portion
> // A '..' element - remove the previous element
>                 if (startElem == startFirstElem)
>                 {
>                     // Previous element is missing
>                     throw new FileSystemException(
>                             "vfs.provider/invalid-relative-path.error");
>                 }
> But in jdk URI it is saying that
> public URI normalize()
>     Normalizes this URI's path.
>     If this URI is opaque, or if its path is already in normal form, then this URI is
returned. Otherwise a new URI is constructed that is identical to this URI except that its
path is computed by normalizing this URI's path in a manner consistent with RFC 2396, section
5.2, step 6, sub-steps c through f; that is:
>        1.
>           All "." segments are removed.
>        2.
>           If a ".." segment is preceded by a non-".." segment then both of these segments
are removed. This step is repeated until it is no longer applicable.
>        3.
>           If the path is relative, and if its first segment contains a colon character
(':'), then a "." segment is prepended. This prevents a relative URI with a path such as "a:b/c/d"
from later being re-parsed as an opaque URI with a scheme of "a" and a scheme-specific part
of "b/c/d". (Deviation from RFC 2396) 
>     A normalized path will begin with one or more ".." segments if there were insufficient
non-".." segments preceding them to allow their removal. A normalized path will begin with
a "." segment if one was inserted by step 3 above. Otherwise, a normalized path will not contain
any "." or ".." segments.
>     Returns:
>         A URI equivalent to this URI, but whose path is in normal form
> So can you please tell us how can we use ../../ in a uri for traversing to the parent
> If we are passing the path like
> sftp://sftpuser:{AFF12398KYUJN982FGTB}@
this it is working fine, in this case 'output' directory is under sftpuser's home directory
> Please treat it as urgent and pls help us
> Thanks in advance
> Ajesh Babu

This message was sent by Atlassian JIRA

View raw message