Skip to content

Commit 42801d6

Browse files
committed
Updates from code review feedback
1 parent 18975a7 commit 42801d6

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/SIL.XForge.Scripture/Services/DeltaUsxMapper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ private static bool CanParaContainVerseText(string? style)
177177

178178
public static string ExtractBookId(string usfm)
179179
{
180-
string firstLine = usfm.Split('\n').FirstOrDefault()?.Trim() ?? string.Empty;
181-
return BookIdRegex().Match(firstLine).Groups[1].Value;
180+
Match match = BookIdRegex().Match(usfm);
181+
return match.Success ? match.Groups[1].Value : string.Empty;
182182
}
183183

184184
/// <summary>

src/SIL.XForge.Scripture/Services/MachineApiService.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
using Chapter = SIL.XForge.Scripture.Models.Chapter;
3131
using TextInfo = SIL.XForge.Scripture.Models.TextInfo;
3232

33+
// Disable notice "The logging message template should not vary between calls to..."
3334
#pragma warning disable CA2254
3435

3536
namespace SIL.XForge.Scripture.Services;
@@ -167,7 +168,9 @@ await hubContext.NotifyDraftApplyProgress(
167168
await hubContext.NotifyDraftApplyProgress(sfProjectId, new DraftApplyState { State = message });
168169
}
169170

170-
// Ensure that if chapters is blank, it contains every chapter in the book
171+
// Ensure that if chapters is blank, it contains every chapter in the book.
172+
// ScriptureRangeParser will return no chapters, meaning all chapters,
173+
// if the scripture range just specifies a book without chapter numbers.
171174
List<int> chapters = bookChapters;
172175
if (chapters.Count == 0)
173176
{

0 commit comments

Comments
 (0)