mirror of
https://github.com/BrenBroZAYT/gameyfin.git
synced 2026-06-13 16:40:01 +00:00
Fix bug when trying to determine file size for files (instead of directories)
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<artifactId>gameyfin</artifactId>
|
||||
<groupId>de.grimsi</groupId>
|
||||
<version>1.1.2</version>
|
||||
<version>1.1.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>gameyfin-backend</artifactId>
|
||||
|
||||
@@ -104,8 +104,19 @@ public class GameMapper {
|
||||
|
||||
stopWatch.start();
|
||||
|
||||
// Some benchmarks I did have shown that trying to parallelize this process makes it slower instead of faster
|
||||
long fileSize = FileUtils.sizeOfDirectory(path.toFile());
|
||||
long fileSize;
|
||||
|
||||
if(Files.isDirectory(path)) {
|
||||
// Some benchmarks I did have shown that trying to parallelize this process makes it slower instead of faster
|
||||
fileSize = FileUtils.sizeOfDirectory(path.toFile());
|
||||
} else {
|
||||
try{
|
||||
fileSize = Files.size(path);
|
||||
} catch (IOException e) {
|
||||
log.error("Error while calculating size of file '{}'.", path);
|
||||
fileSize = -1L;
|
||||
}
|
||||
}
|
||||
|
||||
stopWatch.stop();
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>gameyfin</artifactId>
|
||||
<groupId>de.grimsi</groupId>
|
||||
<version>1.1.2</version>
|
||||
<version>1.1.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user