Some minor bugfixes

This commit is contained in:
2021-12-01 16:49:21 +01:00
parent 785e4f57c4
commit c828d1534d

View File

@@ -108,6 +108,10 @@ public class FileInfoService {
try { try {
thumbPath = Paths.get("/lalafin/file" + requestedPath + "/.thumbnails/" thumbPath = Paths.get("/lalafin/file" + requestedPath + "/.thumbnails/"
+ fileName + ".jpg"); + fileName + ".jpg");
if (!Files.exists(thumbPath)) {
thumbPath = Paths.get("/lalafin/file" + requestedPath
+ "/.thumbnails/" + fileName + ".png");
}
} catch (Exception ignored) { } catch (Exception ignored) {
} }
@@ -134,7 +138,12 @@ public class FileInfoService {
if ((thumbPath != null && Files.exists(thumbPath)) if ((thumbPath != null && Files.exists(thumbPath))
|| thumbnailService.generateThumbnail(contentInfo, thumbPath)) { || thumbnailService.generateThumbnail(contentInfo, thumbPath)) {
contentInfo.thumbnailUrl = contentInfo.thumbnailUrl =
"/file" + requestedUri + "/.thumbnails/" + fileUri + ".jpg"; "/file" + requestedUri + "/.thumbnails/" + fileUri;
if (thumbPath.toString().endsWith(".jpg")) {
contentInfo.thumbnailUrl += ".jpg";
} else if (thumbPath.toString().endsWith(".png")) {
contentInfo.thumbnailUrl += ".png";
}
} }
folderInfo.content.add(contentInfo); folderInfo.content.add(contentInfo);
}); });
@@ -154,9 +163,9 @@ public class FileInfoService {
+ "/" + requestedFilenameUri; + "/" + requestedFilenameUri;
} }
if (requestedFilename.endsWith(".zip")) { if (requestedFilename.endsWith(".zip")) {
fileInfo.viewUrl = "/view" + requestedUri + "/" + requestedFilenameUri + "/1"; fileInfo.viewUrl = "/view" + requestedUri + "/1";
} else if (requestedFilename.endsWith(".epub")) { } else if (requestedFilename.endsWith(".epub")) {
fileInfo.viewUrl = "/view" + requestedUri + "/" + requestedFilenameUri + "/0"; fileInfo.viewUrl = "/view" + requestedUri + "/0";
} }
return fileInfo; return fileInfo;
} }