[
https://issues.apache.org/jira/browse/VFS-376?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ajesh babu updated VFS-376:
---------------------------
Remaining Estimate: 3h (was: 892h)
Original Estimate: 3h (was: 892h)
> SFTP uri is throwing error when .. is using in path
> ---------------------------------------------------
>
> Key: VFS-376
> URL: https://issues.apache.org/jira/browse/VFS-376
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.0
> Reporter: Ajesh babu
> Priority: Blocker
> 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}@172.24.0.114:22/../../../../app/utenti/sftpuser/output/transaction_CARTASI_20200429083817.csv"
> 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 directory.
> If we are passing the path like
> sftp://sftpuser:{AFF12398KYUJN982FGTB}@172.24.0.114:22/output/transaction_CARTASI_20200429083817.csv
> this it is working fine, in this case 'output' directory is under sftpuser's
> home directory (app/utenti/sftpuser}
> Please treat it as urgent and pls help us
> Thanks in advance
> Ajesh Babu
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira