mirror of
https://github.com/BrenBroZAYT/gameyfin.git
synced 2026-06-16 16:20:04 +00:00
Fix bug in FilesystemService trying to read content of zip files while scanning
This commit is contained in:
@@ -81,7 +81,7 @@ class FilesystemService(
|
|||||||
val gamefileExtensions = gameFileExtensions
|
val gamefileExtensions = gameFileExtensions
|
||||||
|
|
||||||
// Filter out invalid directories (directories could have been changed externally after the library was created)
|
// Filter out invalid directories (directories could have been changed externally after the library was created)
|
||||||
val validDirectories = library.directories.map { Path(it.internalPath) }
|
val validPaths = library.directories.map { Path(it.internalPath) }
|
||||||
.filter { path ->
|
.filter { path ->
|
||||||
if (!path.isDirectory()) {
|
if (!path.isDirectory()) {
|
||||||
log.warn { "Invalid directory '$path' in library '${library.name}'" }
|
log.warn { "Invalid directory '$path' in library '${library.name}'" }
|
||||||
@@ -93,16 +93,18 @@ class FilesystemService(
|
|||||||
|
|
||||||
// Get all paths that are directories or match the game file extensions
|
// Get all paths that are directories or match the game file extensions
|
||||||
// Also check if the directory is empty and if empty directories should be included
|
// Also check if the directory is empty and if empty directories should be included
|
||||||
val currentFilesystemPaths = validDirectories.flatMap { validDirectory ->
|
val currentFilesystemPaths = validPaths.flatMap { validDirectory ->
|
||||||
safeReadDirectoryContents(validDirectory)
|
safeReadDirectoryContents(validDirectory)
|
||||||
.filter { it.isDirectory() || it.extension.lowercase() in gamefileExtensions }
|
.filter { it.isDirectory() || it.extension.lowercase() in gamefileExtensions }
|
||||||
.filter {
|
.filter {
|
||||||
|
if (!it.isDirectory()) return@filter true
|
||||||
|
|
||||||
val contents = safeReadDirectoryContents(it)
|
val contents = safeReadDirectoryContents(it)
|
||||||
if (contents.isEmpty() && !config.get(ConfigProperties.Libraries.Scan.ScanEmptyDirectories)!!) {
|
if (contents.isEmpty() && !config.get(ConfigProperties.Libraries.Scan.ScanEmptyDirectories)!!) {
|
||||||
log.debug { "Directory '$it' is empty and will be ignored" }
|
log.debug { "Directory '$it' is empty and will be ignored" }
|
||||||
false
|
return@filter false
|
||||||
} else {
|
} else {
|
||||||
true
|
return@filter true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user