Skip to content

Commit

Permalink
fix: check if the remote source has any chapters before marking
Browse files Browse the repository at this point in the history
  • Loading branch information
oae committed Jan 28, 2023
1 parent 5713cd6 commit a4d787d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/server/utils/mangal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@ export const removeChapter = async (mangaDir: string, chapterFileName: string) =
export const getOutOfSyncChapters = async (mangaDir: string, source: string, title: string) => {
const localChapters = await getChaptersFromLocal(mangaDir);
const remoteChapters = await getChaptersFromRemote(source, title);
if (remoteChapters.length === 0) {
logger.info('Source may not be available. I will not mark any chapter for removal.');
return [];
}
const remoteChaptersWithIndex = remoteChapters.map((r) => ({
fileName: `[${String(r.index + 1).padStart(4, '0')}]_${sanitizer(r.name)}.cbz`,
index: r.index + 1,
Expand Down

0 comments on commit a4d787d

Please sign in to comment.