Skip to content

Commit

Permalink
Merge pull request #85 from elv1s42/master
Browse files Browse the repository at this point in the history
Fix for #82 and #84
  • Loading branch information
NikolayPianikov committed Aug 28, 2023
2 parents 362343d + 2f78ad4 commit 3b18547
Showing 1 changed file with 2 additions and 35 deletions.
37 changes: 2 additions & 35 deletions src/extension/ServiceMessageFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,7 @@ internal class ServiceMessageFactory : IServiceMessageFactory
private const string TcParseServiceMessagesInside = "tc:parseServiceMessagesInside";
private static readonly IEnumerable<ServiceMessage> EmptyServiceMessages = new ServiceMessage[0];
private static readonly Regex AttachmentDescriptionRegex = new Regex("(.*)=>(.+)", RegexOptions.Compiled);
private static readonly List<char> _invalidChars;

static ServiceMessageFactory()
{
var invalidPathChars = Path.GetInvalidPathChars();
var invalidFileNameChars = Path.GetInvalidFileNameChars();
_invalidChars = new List<char>(invalidPathChars.Length + invalidFileNameChars.Length);
foreach (var c in invalidPathChars)
{
_invalidChars.Add(c);
}

foreach (var c in invalidFileNameChars)
{
if (_invalidChars.Contains(c))
{
continue;
}

_invalidChars.Add(c);
}
}


public ServiceMessageFactory(ITeamCityInfo teamCityInfo, ISuiteNameReplacer suiteNameReplacer)
{
_teamCityInfo = teamCityInfo;
Expand Down Expand Up @@ -382,18 +360,7 @@ private static IEnumerable<ServiceMessage> Attachments(EventId eventId, XmlNode

if (artifactDir == null)
{
var testDirNameChars = new char[eventId.FullName.Length];
eventId.FullName.CopyTo(0, testDirNameChars, 0, eventId.FullName.Length);
for (var i = 0; i < testDirNameChars.Length; i++)
{
if (_invalidChars.Contains(testDirNameChars[i]))
{
testDirNameChars[i] = '_';
}
}

var testDirName = new string(testDirNameChars);
artifactDir = ".teamcity/NUnit/" + testDirName + "/" + Guid.NewGuid();
artifactDir = ".teamcity/NUnit/" + Guid.NewGuid();
}

string artifactType;
Expand Down

0 comments on commit 3b18547

Please sign in to comment.