fix: improve line splitting to handle both LF and CRLF line endings (#1106)

This commit is contained in:
Gadfly 2025-03-17 19:59:28 +08:00 committed by GitHub
parent a0cddaea80
commit b930066b5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View file

@ -16,7 +16,7 @@ namespace SourceGit.Commands
var rs = ReadToEnd();
if (rs.IsSuccess)
{
var lines = rs.StdOut.Split('\n', StringSplitOptions.RemoveEmptyEntries);
var lines = rs.StdOut.Split(['\n', '\r'], StringSplitOptions.RemoveEmptyEntries);
return lines.Length;
}

View file

@ -1,4 +1,6 @@
namespace SourceGit.Commands
using System;
namespace SourceGit.Commands
{
public class QueryCommitSignInfo : Command
{
@ -22,7 +24,7 @@
if (raw.Length <= 1)
return null;
var lines = raw.Split('\n');
var lines = raw.Split(['\n', '\r'], StringSplitOptions.RemoveEmptyEntries);
return new Models.CommitSignInfo()
{
VerifyResult = lines[0][0],