mirror of
https://github.com/gotson/komga.git
synced 2025-12-06 08:32:25 +01:00
exclude directories from rar files listing
This commit is contained in:
parent
10f5917d1c
commit
3c4d1b3c28
1 changed files with 5 additions and 3 deletions
|
|
@ -1,7 +1,6 @@
|
|||
package org.gotson.komga.infrastructure.archive
|
||||
|
||||
import com.github.junrar.Archive
|
||||
import com.github.junrar.Junrar
|
||||
import org.springframework.stereotype.Service
|
||||
import java.io.InputStream
|
||||
import java.nio.file.Files
|
||||
|
|
@ -11,9 +10,12 @@ import java.nio.file.Path
|
|||
class RarExtractor : ArchiveExtractor() {
|
||||
|
||||
override fun getFilenames(path: Path): List<String> {
|
||||
val contentsDescription = Junrar.getContentsDescription(path.toFile())
|
||||
val archive = Archive(Files.newInputStream(path))
|
||||
|
||||
return contentsDescription.map { it.path }.sortedWith(natSortComparator)
|
||||
return archive.fileHeaders
|
||||
.filter { !it.isDirectory }
|
||||
.map { it.fileNameString }
|
||||
.sortedWith(natSortComparator)
|
||||
}
|
||||
|
||||
override fun getEntryStream(path: Path, entryName: String): InputStream {
|
||||
|
|
|
|||
Loading…
Reference in a new issue