From 80b2ebc45b5f04bcd832ed2497d3f2f6ea4adf10 Mon Sep 17 00:00:00 2001 From: Shamicen <84282253+Shamicen@users.noreply.github.com> Date: Sat, 1 Oct 2022 05:41:40 +0200 Subject: [PATCH] Fix ComicInfo.xml not being read if .noxml file exists too (#8111) * gives ComicInfo.xml files priority over noxml files if both are at the chapter root. * delete the noxml file if both a noXml file and a ComicInfo file exist --- .../java/eu/kanade/tachiyomi/source/LocalSource.kt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt b/app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt index b821e6dca2..10910fafbe 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt @@ -150,17 +150,20 @@ class LocalSource( // Augment manga details based on metadata files try { val mangaDirFiles = getMangaDirsFiles(manga.url, baseDirsFile).toList() - val comicInfoMetadata = mangaDirFiles - .firstOrNull { it.name == COMIC_INFO_FILE || it.name == ".noxml" } + val comicInfoFile = mangaDirFiles + .firstOrNull { it.name == COMIC_INFO_FILE } + val noXmlFile = mangaDirFiles + .firstOrNull { it.name == ".noxml" } + if (comicInfoFile != null && noXmlFile != null) noXmlFile.delete() when { // Top level ComicInfo.xml - comicInfoMetadata?.name == COMIC_INFO_FILE -> { - setMangaDetailsFromComicInfoFile(comicInfoMetadata.inputStream(), manga) + comicInfoFile != null -> { + setMangaDetailsFromComicInfoFile(comicInfoFile.inputStream(), manga) } // Copy ComicInfo.xml from chapter archive to top level if found - comicInfoMetadata == null -> { + noXmlFile == null -> { val chapterArchives = mangaDirFiles .filter { isSupportedArchiveFile(it.extension) } .toList()