From deeb92aef56e7f19eddd46f222751301b99d832c Mon Sep 17 00:00:00 2001 From: zHaytam Date: Thu, 6 Feb 2020 09:04:59 +0100 Subject: [PATCH 1/2] Double quote issue labels --- Octokit.Tests/Models/SearchIssuesRequestTests.cs | 6 +++--- Octokit/Models/Request/SearchIssuesRequest.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Octokit.Tests/Models/SearchIssuesRequestTests.cs b/Octokit.Tests/Models/SearchIssuesRequestTests.cs index caafd0ba5c..9227e7a8e0 100644 --- a/Octokit.Tests/Models/SearchIssuesRequestTests.cs +++ b/Octokit.Tests/Models/SearchIssuesRequestTests.cs @@ -114,9 +114,9 @@ public void HandlesLabelsAttributeCorrectly() var request = new SearchIssuesRequest("test"); Assert.DoesNotContain(request.MergedQualifiers(), x => x.Contains("label:")); - request.Labels = new[] { "label1", "label2" }; - Assert.Contains("label:label1", request.MergedQualifiers()); - Assert.Contains("label:label2", request.MergedQualifiers()); + request.Labels = new[] { "label1", "label 2" }; + Assert.Contains("label:\"label1\"", request.MergedQualifiers()); + Assert.Contains("label:\"label 2\"", request.MergedQualifiers()); } [Fact] diff --git a/Octokit/Models/Request/SearchIssuesRequest.cs b/Octokit/Models/Request/SearchIssuesRequest.cs index 2600e27472..5b5508a34a 100644 --- a/Octokit/Models/Request/SearchIssuesRequest.cs +++ b/Octokit/Models/Request/SearchIssuesRequest.cs @@ -328,7 +328,7 @@ public override IReadOnlyList MergedQualifiers() if (Labels != null) { - parameters.AddRange(Labels.Select(label => string.Format(CultureInfo.InvariantCulture, "label:{0}", label))); + parameters.AddRange(Labels.Select(label => string.Format(CultureInfo.InvariantCulture, "label:\"{0}\"", label))); } if (No.HasValue) From 803c84885295c85e2e40c4ed6411d4cc38d31022 Mon Sep 17 00:00:00 2001 From: zHaytam Date: Thu, 6 Feb 2020 10:01:21 +0100 Subject: [PATCH 2/2] Fix failing tests --- Octokit.Tests/Clients/SearchClientTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Octokit.Tests/Clients/SearchClientTests.cs b/Octokit.Tests/Clients/SearchClientTests.cs index a9800ca3d3..c2ebdabf5a 100644 --- a/Octokit.Tests/Clients/SearchClientTests.cs +++ b/Octokit.Tests/Clients/SearchClientTests.cs @@ -962,7 +962,7 @@ public void TestingTheLabelsQualifier() connection.Received().Get( Arg.Is(u => u.ToString() == "search/issues"), - Arg.Is>(d => d["q"] == "something+label:bug")); + Arg.Is>(d => d["q"] == "something+label:\"bug\"")); } [Fact] @@ -977,7 +977,7 @@ public void TestingTheLabelsQualifier_Multiple() connection.Received().Get( Arg.Is(u => u.ToString() == "search/issues"), - Arg.Is>(d => d["q"] == "something+label:bug+label:feature")); + Arg.Is>(d => d["q"] == "something+label:\"bug\"+label:\"feature\"")); } [Fact] @@ -1560,7 +1560,7 @@ public void TestingTheRepoAndUserAndLabelQualifier() connection.Received().Get( Arg.Is(u => u.ToString() == "search/issues"), Arg.Is>(d => d["q"] == - "something+label:bug+user:alfhenrik+repo:octokit/octokit.net")); + "something+label:\"bug\"+user:alfhenrik+repo:octokit/octokit.net")); } }