[
https://issues.apache.org/jira/browse/SSHD-893?focusedWorklogId=196928&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-196928
]
ASF GitHub Bot logged work on SSHD-893:
---------------------------------------
Author: ASF GitHub Bot
Created on: 11/Feb/19 13:56
Start Date: 11/Feb/19 13:56
Worklog Time Spent: 10m
Work Description: The-Yoda commented on pull request #89: [SSHD-893] Fix
SCP download with pattern issue in rooted filesystem
URL: https://github.com/apache/mina-sshd/pull/89#discussion_r255513337
##########
File path:
sshd-common/src/main/java/org/apache/sshd/common/util/io/DirectoryScanner.java
##########
@@ -244,46 +257,35 @@ public void setIncludes(String[] includes) {
* matching of includes, excludes, and the selectors. When a directory
* is found, it is scanned recursively.
*
- * @param dir The directory to scan. Must not be {@code null}.
- * @param vpath The path relative to the base directory (needed to
- * prevent problems with an absolute path when using
- * dir). Must not be {@code null}.
+ * @param <C> Target matches collection type
+ * @param dir The directory to scan. Must not be {@code null}.
+ * @param vpath The path relative to the base directory (needed to prevent
+ * problems with an absolute path when using <tt>dir</tt>). Must not be
{@code null}.
+ * @param filesList Target {@link Collection} to accumulate the relative
+ * path matches
+ * @throws IOException if failed to scan the directory
*/
- protected void scandir(File dir, String vpath) {
- String[] newfiles = dir.list();
- if (GenericUtils.isEmpty(newfiles)) {
- newfiles = GenericUtils.EMPTY_STRING_ARRAY;
- }
-
- for (String newfile : newfiles) {
- String name = vpath + newfile;
- File file = new File(dir, newfile);
- if (file.isDirectory()) {
- if (isIncluded(name)) {
- filesIncluded.add(name);
- scandir(file, name + File.separator);
- } else if (couldHoldIncluded(name)) {
- scandir(file, name + File.separator);
- }
- } else if (file.isFile()) {
- if (isIncluded(name)) {
- filesIncluded.add(name);
+ protected <C extends Collection<Path>> C scandir(Path rootDir, Path dir, C
filesList) throws IOException {
+ try (DirectoryStream<Path> ds = Files.newDirectoryStream(dir)) {
+ for (Path p : ds) {
+ Path rel = rootDir.relativize(p);
+ String name = rel.toString();
Review comment:
nit: `rootDir.relativize(p).toString()` should do?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 196928)
Time Spent: 0.5h (was: 20m)
> SCP download with pattern does not work download with virtual filesystem
> ------------------------------------------------------------------------
>
> Key: SSHD-893
> URL: https://issues.apache.org/jira/browse/SSHD-893
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 2.2.0
> Reporter: Subramaniajeeva
> Assignee: Goldstein Lyor
> Priority: Minor
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> Right now, download with pattern doesn't work when the underlying
> filesystem is virtual filesystem. Also, current tests were masking the
> behaviour by providing working location as rooted filesystem path.
> Handled the same with PR: https://github.com/apache/mina-sshd/pull/88
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)