Skip to content

Commit

Permalink
museumsvictoria#170 exclude '.nodel' directory in listing
Browse files Browse the repository at this point in the history
justparking authored and scroix committed Apr 1, 2024
1 parent 7e8af16 commit 85723e1
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ public List<FileInfo> list() {
@Service(name = "contents", desc = "Returns the contents of the file.")
public NanoHTTPD.Response contents(@Param(name = "path") String path) {
try {
if (Strings.isNullOrEmpty(path))
if (Strings.isBlank(path))
throw new RuntimeException("No file path provided");

FileInputStream fis = new FileInputStream(new File(_root, path));
@@ -160,9 +160,10 @@ private static void listFiles(List<FileInfo> result, String path, File root) {

String name = item.getName();

// TODO: might be a good idea to skip special "." and "_" tagged files
// if (name.startsWith("_") || name.startsWith("."))
// continue;
if (name.equals(".nodel"))
continue;

// further filtering could be done here

String newPath = path.length() > 0 ? path + "/" + name : name;

0 comments on commit 85723e1

Please sign in to comment.