瀏覽代碼

Fixes case where manga name ends with s. (#919)

Bram van de Kerkhof 7 年之前
父節點
當前提交
aefe7b176a

+ 1 - 1
app/src/main/java/eu/kanade/tachiyomi/util/ChapterRecognition.kt

@@ -29,7 +29,7 @@ object ChapterRecognition {
      * Regex used to remove unwanted tags
      * Example Prison School 12 v.1 vol004 version1243 volume64 -R> Prison School 12
      */
-    private val unwanted = Regex("""(?:(v|ver|vol|version|volume|season|s).?[0-9]+)""")
+    private val unwanted = Regex("""(?<![a-z])(v|ver|vol|version|volume|season|s).?[0-9]+""")
 
     /**
      * Regex used to remove unwanted whitespace

+ 11 - 0
app/src/test/java/eu/kanade/tachiyomi/data/database/ChapterRecognitionTest.kt

@@ -440,4 +440,15 @@ class ChapterRecognitionTest {
         ChapterRecognition.parseChapterNumber(chapter, manga)
         assertThat(chapter.chapter_number).isEqualTo(20f)
     }
+
+    /**
+     * Test for chapters ending with s
+     */
+    @Test fun chaptersEndingWithS() {
+        createManga("One Outs")
+
+        createChapter("One Outs 001")
+        ChapterRecognition.parseChapterNumber(chapter, manga)
+        assertThat(chapter.chapter_number).isEqualTo(1f)
+    }
 }