Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Commit a4d787d

Browse files
committed
fix: check if the remote source has any chapters before marking
1 parent 5713cd6 commit a4d787d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/server/utils/mangal.ts

+4
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,10 @@ export const removeChapter = async (mangaDir: string, chapterFileName: string) =
371371
export const getOutOfSyncChapters = async (mangaDir: string, source: string, title: string) => {
372372
const localChapters = await getChaptersFromLocal(mangaDir);
373373
const remoteChapters = await getChaptersFromRemote(source, title);
374+
if (remoteChapters.length === 0) {
375+
logger.info('Source may not be available. I will not mark any chapter for removal.');
376+
return [];
377+
}
374378
const remoteChaptersWithIndex = remoteChapters.map((r) => ({
375379
fileName: `[${String(r.index + 1).padStart(4, '0')}]_${sanitizer(r.name)}.cbz`,
376380
index: r.index + 1,

0 commit comments

Comments
 (0)