respect hidden attribute for file and smb directory listing

(hidden directories are not listed, effects crawling of local file system)
pull/44/head
reger 9 years ago
parent cc79ad8de6
commit 535d4bf75f

@ -2256,9 +2256,16 @@ public class MultiProtocolURL implements Serializable, Comparable<MultiProtocolU
return null;
}
/**
* Get directory listing of file or smb url
* respects the hidden attribute of a directory (return null if hidden)
*
* @return names of files and directories or null
* @throws IOException
*/
public String[] list() throws IOException {
if (isFile()) return getFSFile().list();
if (isSMB()) try {
if (isFile() && !isHidden()) return getFSFile().list();
if (isSMB() && !isHidden()) try {
final SmbFile sf = getSmbFile();
if (!sf.isDirectory()) return null;
try {

@ -204,22 +204,24 @@ public class DocumentIndex extends Segment {
return;
}
final String[] s = start.list();
AnchorURL w;
for ( final String t : s ) {
try {
w = new AnchorURL(start, t);
if ( w.canRead() && !w.isHidden() ) {
if ( w.isDirectory() ) {
addConcurrent(w);
} else {
try {
this.queue.put(w);
} catch (final InterruptedException e ) {
if (s != null) {
AnchorURL w;
for ( final String t : s ) {
try {
w = new AnchorURL(start, t);
if ( w.canRead() && !w.isHidden() ) {
if ( w.isDirectory() ) {
addConcurrent(w);
} else {
try {
this.queue.put(w);
} catch (final InterruptedException e ) {
}
}
}
} catch (final MalformedURLException e1 ) {
ConcurrentLog.logException(e1);
}
} catch (final MalformedURLException e1 ) {
ConcurrentLog.logException(e1);
}
}
}

Loading…
Cancel
Save