-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accepting relative URLs #2235
Accepting relative URLs #2235
Conversation
src/Sarif/RuleUtilities.cs
Outdated
{ | ||
result.Locations = new List<Location> { | ||
new Sarif.Location { | ||
PhysicalLocation = new PhysicalLocation | ||
{ | ||
ArtifactLocation = new ArtifactLocation | ||
{ | ||
Uri = new Uri(targetPath) | ||
Uri = context.TargetUri.IsAbsoluteUri ? new Uri(context.TargetUri.LocalPath) : context.TargetUri |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uri [](start = 77, length = 3)
why can't we reuse context.TargetUri here?
@@ -173,7 +175,8 @@ public static string GetFileName(this Uri uri) | |||
{ | |||
if (!uri.IsAbsoluteUri) | |||
{ | |||
throw new InvalidOperationException(); | |||
var newAbsoluteUri = new Uri(BaseUri, uri.OriginalString); | |||
return Path.GetFileName(newAbsoluteUri.LocalPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetFileName [](start = 28, length = 11)
make sure this works with a path like \blah.txt and blah.txt (no prefixed slash). #Closed
src/Sarif/ExtensionMethods.cs
Outdated
@@ -16,6 +16,8 @@ namespace Microsoft.CodeAnalysis.Sarif | |||
{ | |||
public static class ExtensionMethods | |||
{ | |||
private static readonly Uri BaseUri = new Uri("https://github.com/microsoft/sarif-sdk/"); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use https://example.com here (and provide a comment). actually! how about declaring this as an inlined string const in your helper? #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…b.com/microsoft/sarif-sdk into users/ednakamu/accepting-relative-url
No description provided.