From 74fab1c53fd3850bf0fd075c93622f14ad8dbe30 Mon Sep 17 00:00:00 2001 From: ulrich Date: Wed, 06 Jan 2021 23:03:51 +0000 Subject: [PATCH] null pruefung hinzugefuegt --- src/java/de/uhilger/filecms/pub/Catalog.java | 40 +++++++++++++++++++++------------------- 1 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/java/de/uhilger/filecms/pub/Catalog.java b/src/java/de/uhilger/filecms/pub/Catalog.java index 9538eee..5381c92 100644 --- a/src/java/de/uhilger/filecms/pub/Catalog.java +++ b/src/java/de/uhilger/filecms/pub/Catalog.java @@ -19,7 +19,7 @@ package de.uhilger.filecms.pub; import de.uhilger.filecms.api.Api; -import de.uhilger.filecms.data.Bild; +import de.uhilger.wbx.Bild; import de.uhilger.filecms.data.FileRef; import java.io.File; import java.util.ArrayList; @@ -64,26 +64,28 @@ } private List<FileRef> listInt(String relPath, String orderBy, String order) { - Bild bild = new Bild(); List<FileRef> files = new ArrayList(); - StringBuffer path = new StringBuffer(PUB_DIR_PATH); // www/ - path.append(relPath); - File dir = new File(getBase().getAbsolutePath(), path.toString()); - if(dir.exists()) { - File[] fileArray = dir.listFiles(); - if(orderBy != null && orderBy.equalsIgnoreCase("date")) { - Arrays.sort(fileArray, new FileDateComparator(order)); - } - for(int i = 0; i < fileArray.length; i++) { - logger.fine(fileArray[i].toURI().toString()); - String fname = fileArray[i].toURI().toString().replace("file:/", ""); - if(fileArray[i].isDirectory()) { - fname = fname.substring(0, fname.length() - 1); + if(!relPath.startsWith(".")) { + Bild bild = new Bild(); + StringBuffer path = new StringBuffer(PUB_DIR_PATH); // www/ + path.append(relPath); + File dir = new File(getBase().getAbsolutePath(), path.toString()); + if(dir.exists()) { + File[] fileArray = dir.listFiles(new ImgFileFilter()); + if(orderBy != null && orderBy.equalsIgnoreCase("date")) { + Arrays.sort(fileArray, new FileDateComparator(order)); } - logger.fine(fname); - FileRef ref = new FileRef(fname, fileArray[i].isDirectory()); - ref.setMimetype(bild.getMimeType(fileArray[i])); - files.add(ref); + for(int i = 0; i < fileArray.length; i++) { + logger.fine(fileArray[i].toURI().toString()); + String fname = fileArray[i].toURI().toString().replace("file:/", ""); + if(fileArray[i].isDirectory()) { + fname = fname.substring(0, fname.length() - 1); + } + logger.fine(fname); + FileRef ref = new FileRef(fname, fileArray[i].isDirectory()); + ref.setMimetype(bild.getMimeType(fileArray[i])); + files.add(ref); + } } } return files; -- Gitblit v1.9.3