mirror of
https://github.com/iterate-ch/cyberduck.git
synced 2026-05-26 19:10:49 +00:00
Support absolute path in Include with wildcard.
This commit is contained in:
+1
-1
@@ -356,7 +356,7 @@ public class OpenSshConfig {
|
||||
if(parent.isDirectory()) {
|
||||
log.debug("Resolve files in {} matching {}", parent, PathNormalizer.name(pattern));
|
||||
try {
|
||||
for(Local l : directory.list(new NullFilter<String>() {
|
||||
for(Local l : parent.list(new NullFilter<String>() {
|
||||
@Override
|
||||
public boolean accept(final String file) {
|
||||
return FilenameUtils.wildcardMatch(file, PathNormalizer.name(pattern));
|
||||
|
||||
@@ -48,6 +48,22 @@ public class OpenSshConfigTest {
|
||||
config.delete();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIncludeAbsolutePathWithWildcard() throws Exception {
|
||||
final File config = tmp.newFile("config-include-absolute-glob");
|
||||
final String dir = Paths.get("src/test/resources/openssh").toAbsolutePath().toString();
|
||||
try(final FileWriter w = new FileWriter(config)) {
|
||||
w.write("Include " + dir + "/include-*\n");
|
||||
}
|
||||
final OpenSshConfig sshConfig = new OpenSshConfig(new Local(config.getAbsolutePath()));
|
||||
final OpenSshConfig.Host hostA = sshConfig.lookup("include-host-a");
|
||||
assertEquals("host-a.example.com", hostA.getHostName());
|
||||
assertEquals("auser", hostA.getUser());
|
||||
final OpenSshConfig.Host hostB = sshConfig.lookup("include-host-b");
|
||||
assertEquals("host-b.example.com", hostB.getHostName());
|
||||
assertEquals("buser", hostB.getUser());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIncludeSpecificFile() {
|
||||
final OpenSshConfig config = new OpenSshConfig(new Local("src/test/resources", "openssh/config-include-specific"));
|
||||
|
||||
Reference in New Issue
Block a user