mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 23:29:16 +01:00
Merge pull request #151 from icewind1991/chapter-recognition-fallback
Fix infinite loop when no chapter number is parsed
This commit is contained in:
commit
ff46c61f63
@ -111,6 +111,8 @@ public class ChapterRecognition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Strip anything after "part xxx" and try that
|
// Strip anything after "part xxx" and try that
|
||||||
|
matcher = pPart.matcher(name);
|
||||||
|
if (matcher.find()) {
|
||||||
name = pPart.matcher(name).replaceAll("$1");
|
name = pPart.matcher(name).replaceAll("$1");
|
||||||
dummyChapter.name = name;
|
dummyChapter.name = name;
|
||||||
parseChapterNumber(dummyChapter, manga);
|
parseChapterNumber(dummyChapter, manga);
|
||||||
@ -119,6 +121,7 @@ public class ChapterRecognition {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* x.a -> x.1, x.b -> x.2, etc
|
* x.a -> x.1, x.b -> x.2, etc
|
||||||
|
@ -172,4 +172,11 @@ public class ChapterRecognitionTest {
|
|||||||
ChapterRecognition.parseChapterNumber(c, randomManga);
|
ChapterRecognition.parseChapterNumber(c, randomManga);
|
||||||
assertThat(c.chapter_number).isEqualTo(027f);
|
assertThat(c.chapter_number).isEqualTo(027f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUnparsable() {
|
||||||
|
Chapter c = createChapter("Foo");
|
||||||
|
ChapterRecognition.parseChapterNumber(c, randomManga);
|
||||||
|
assertThat(c.chapter_number).isEqualTo(-1f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user