Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ public sealed class CreateWebhookSubscriptionCommandValidator : AbstractValidato
{
public CreateWebhookSubscriptionCommandValidator()
{
RuleFor(x => x.Url).NotEmpty().Must(url => Uri.TryCreate(url, UriKind.Absolute, out _))
RuleFor(x => x.Url).NotEmpty()
.Must(url => Uri.TryCreate(url, UriKind.Absolute, out var uri)
&& (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps))
.WithMessage("A valid absolute URL is required.");
RuleFor(x => x.Events).NotEmpty().WithMessage("At least one event type is required.");
}
Expand Down
11 changes: 9 additions & 2 deletions src/Tests/Architecture.Tests/BuildingBlocksIndependenceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void BuildingBlocks_Projects_Should_Not_Reference_Modules_Directly()

foreach (string include in references)
{
string referencedName = Path.GetFileNameWithoutExtension(include);
string referencedName = GetReferencedProjectName(include);

// Check if it references a Modules project
if (referencedName.StartsWith("Modules.", StringComparison.OrdinalIgnoreCase))
Expand Down Expand Up @@ -224,7 +224,7 @@ private static void CheckBuildingBlockDependencies(
var projectReferences = document
.Descendants("ProjectReference")
.Select(x => (string?)x.Attribute("Include") ?? string.Empty)
.Select(p => Path.GetFileNameWithoutExtension(p))
.Select(GetReferencedProjectName)
.Where(p => !string.IsNullOrEmpty(p))
.ToArray();

Expand All @@ -236,4 +236,11 @@ private static void CheckBuildingBlockDependencies(
}
}
}

// ProjectReference Include paths are authored with Windows separators (e.g. ..\Core\Core.csproj).
// Path.GetFileNameWithoutExtension only treats '\' as a separator on Windows, so on Linux CI it
// returns the whole path minus the extension. Normalize to '/' first to get the bare project name
// on every platform.
private static string GetReferencedProjectName(string includePath) =>
Path.GetFileNameWithoutExtension(includePath.Replace('\\', '/'));
}
Loading