Skip to content

Commit a24c984

Browse files
authored
Merge pull request #447 from mharen/all-caps-url-payload-generator
url payload generator should detect all-caps protocol
2 parents 5f9f437 + 9f712fe commit a24c984

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

QRCoder/PayloadGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ public class Url : Payload
312312
private readonly string url;
313313

314314
/// <summary>
315-
/// Generates a link. If not given, http/https protocol will be added.
315+
/// Generates a link. If the protocol is not specified, the http protocol will be added.
316316
/// </summary>
317317
/// <param name="url">Link url target</param>
318318
public Url(string url)
@@ -322,7 +322,7 @@ public Url(string url)
322322

323323
public override string ToString()
324324
{
325-
return (!this.url.StartsWith("http") ? "http://" + this.url : this.url);
325+
return (!this.url.StartsWith("http", StringComparison.OrdinalIgnoreCase) ? "http://" + this.url : this.url);
326326
}
327327
}
328328

QRCoderTests/PayloadGeneratorTests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,18 @@ public void url_should_build_https()
757757
}
758758

759759

760+
[Fact]
761+
[Category("PayloadGenerator/Url")]
762+
public void url_should_build_https_all_caps()
763+
{
764+
var url = "HTTPS://CODE-BUDE.NET";
765+
766+
var generator = new PayloadGenerator.Url(url);
767+
768+
generator.ToString().ShouldBe("HTTPS://CODE-BUDE.NET");
769+
}
770+
771+
760772
[Fact]
761773
[Category("PayloadGenerator/Url")]
762774
public void url_should_add_http()

0 commit comments

Comments
 (0)