fix(epub): strip formatting from ISBN values to ensure correct extraction (#2248)
Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
This commit is contained in:
+13
@@ -386,6 +386,19 @@ class EpubMetadataExtractorTest {
|
||||
() -> assertEquals("1234567890", result.getIsbn10())
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Should extract formatted ISBN-10 as ISBN-10, not ISBN-13")
|
||||
void extractMetadata_withFormattedIsbn10_returnsIsbn10() throws IOException {
|
||||
// "90-206-1280-8" is 13 characters long, causing it to be mistaken for ISBN-13 if formatting isn't stripped
|
||||
File epubFile = createEpubWithIsbn(null, "90-206-1280-8");
|
||||
|
||||
BookMetadata result = extractor.extractMetadata(epubFile);
|
||||
|
||||
assertNotNull(result);
|
||||
assertEquals("90-206-1280-8", result.getIsbn10());
|
||||
assertNull(result.getIsbn13(), "Should not set ISBN-13 for a formatted ISBN-10");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
Reference in New Issue
Block a user