From b22f6ac9d6fe30b05a2bd6936e8d250c587b29cc Mon Sep 17 00:00:00 2001 From: glax Date: Sun, 21 Sep 2025 05:33:23 +0200 Subject: [PATCH] Trim leading 0s in chapternumbers --- API/Schema/MangaContext/Chapter.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/API/Schema/MangaContext/Chapter.cs b/API/Schema/MangaContext/Chapter.cs index 504812b..cc0ef6c 100644 --- a/API/Schema/MangaContext/Chapter.cs +++ b/API/Schema/MangaContext/Chapter.cs @@ -34,6 +34,7 @@ public class Chapter : Identifiable, IComparable { if(ChapterNumberRegex.Match(chapterNumber) is not { Success: true } match || !match.Value.Equals(chapterNumber)) throw new ArgumentException($"Invalid chapter number: {chapterNumber}"); + chapterNumber = string.Join('.', chapterNumber.Split('.').Select(p => p.TrimStart('0'))); this.ChapterNumber = chapterNumber; this.ParentManga = parentManga; this.MangaConnectorIds = []; @@ -50,8 +51,6 @@ public class Chapter : Identifiable, IComparable internal Chapter(string key, int? volumeNumber, string chapterNumber, string? title, string fileName, bool downloaded) : base(key) { - if(ChapterNumberRegex.Match(chapterNumber) is not { Success: true } match || !match.Value.Equals(chapterNumber)) - throw new ArgumentException($"Invalid chapter number: {chapterNumber}"); this.VolumeNumber = volumeNumber; this.ChapterNumber = chapterNumber; this.Title = title;