mirror of
https://github.com/C9Glax/tranga.git
synced 2025-10-11 05:09:49 +02:00
Trim leading 0s in chapternumbers
This commit is contained in:
@@ -34,6 +34,7 @@ public class Chapter : Identifiable, IComparable<Chapter>
|
|||||||
{
|
{
|
||||||
if(ChapterNumberRegex.Match(chapterNumber) is not { Success: true } match || !match.Value.Equals(chapterNumber))
|
if(ChapterNumberRegex.Match(chapterNumber) is not { Success: true } match || !match.Value.Equals(chapterNumber))
|
||||||
throw new ArgumentException($"Invalid chapter number: {chapterNumber}");
|
throw new ArgumentException($"Invalid chapter number: {chapterNumber}");
|
||||||
|
chapterNumber = string.Join('.', chapterNumber.Split('.').Select(p => p.TrimStart('0')));
|
||||||
this.ChapterNumber = chapterNumber;
|
this.ChapterNumber = chapterNumber;
|
||||||
this.ParentManga = parentManga;
|
this.ParentManga = parentManga;
|
||||||
this.MangaConnectorIds = [];
|
this.MangaConnectorIds = [];
|
||||||
@@ -50,8 +51,6 @@ public class Chapter : Identifiable, IComparable<Chapter>
|
|||||||
internal Chapter(string key, int? volumeNumber, string chapterNumber, string? title, string fileName, bool downloaded)
|
internal Chapter(string key, int? volumeNumber, string chapterNumber, string? title, string fileName, bool downloaded)
|
||||||
: base(key)
|
: 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.VolumeNumber = volumeNumber;
|
||||||
this.ChapterNumber = chapterNumber;
|
this.ChapterNumber = chapterNumber;
|
||||||
this.Title = title;
|
this.Title = title;
|
||||||
|
Reference in New Issue
Block a user