Skip to content
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

Merged
merged 8 commits into from
Jan 13, 2021
Merged

Conversation

eddynaka
Copy link
Collaborator

No description provided.

@eddynaka eddynaka enabled auto-merge (squash) January 13, 2021 14:04
{
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
Copy link
Member

@michaelcfanning michaelcfanning Jan 13, 2021

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);
Copy link
Member

@michaelcfanning michaelcfanning Jan 13, 2021

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

@@ -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/");

Copy link
Member

@michaelcfanning michaelcfanning Jan 13, 2021

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

Copy link
Member

@michaelcfanning michaelcfanning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@eddynaka eddynaka merged commit e17551f into main Jan 13, 2021
@eddynaka eddynaka deleted the users/ednakamu/accepting-relative-url branch January 13, 2021 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants