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
4 changes: 2 additions & 2 deletions QRCoder/PayloadGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public class Url : Payload
private readonly string url;

/// <summary>
/// Generates a link. If not given, http/https protocol will be added.
/// Generates a link. If the protocol is not specified, the http protocol will be added.
/// </summary>
/// <param name="url">Link url target</param>
public Url(string url)
Expand All @@ -321,7 +321,7 @@ public Url(string url)

public override string ToString()
{
return (!this.url.StartsWith("http") ? "http://" + this.url : this.url);
return (!this.url.StartsWith("http", StringComparison.OrdinalIgnoreCase) ? "http://" + this.url : this.url);
}
}

Expand Down
12 changes: 12 additions & 0 deletions QRCoderTests/PayloadGeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,18 @@ public void url_should_build_https()
}


[Fact]
[Category("PayloadGenerator/Url")]
public void url_should_build_https_all_caps()
{
var url = "HTTPS://CODE-BUDE.NET";

var generator = new PayloadGenerator.Url(url);

generator.ToString().ShouldBe("HTTPS://CODE-BUDE.NET");
}


[Fact]
[Category("PayloadGenerator/Url")]
public void url_should_add_http()
Expand Down