mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Work logged] (SSHD-893) SCP download with pattern does not work download with virtual filesystem
Date Mon, 11 Feb 2019 17:12:00 GMT

     [ https://issues.apache.org/jira/browse/SSHD-893?focusedWorklogId=197052&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-197052
]

ASF GitHub Bot logged work on SSHD-893:
---------------------------------------

                Author: ASF GitHub Bot
            Created on: 11/Feb/19 17:11
            Start Date: 11/Feb/19 17:11
    Worklog Time Spent: 10m 
      Work Description: lgoldstein 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_r255604869
 
 

 ##########
 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:
   1. Cascaded calls are not more efficient than separate ones
   2. Separating calls makes the code more debug-able...
   . 
 
----------------------------------------------------------------
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:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 197052)
    Time Spent: 1h 20m  (was: 1h 10m)

> 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: 1h 20m
>  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)

Mime
View raw message