Support new label names containing colons

This commit is contained in:
Andy Wilkinson
2017-01-10 11:37:29 -05:00
parent 09d542c175
commit dfa379328f
4 changed files with 24 additions and 5 deletions

View File

@@ -19,6 +19,7 @@ package io.spring.issuebot.github;
import java.io.IOException;
import java.lang.reflect.Type;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.Collections;
@@ -153,9 +154,16 @@ public class GitHubTemplate implements GitHubOperations {
@Override
public Issue removeLabel(Issue issue, String labelName) {
String encodedName;
try {
encodedName = new URI(null, null, labelName, null).toString();
}
catch (URISyntaxException ex) {
throw new RuntimeException(ex);
}
ResponseEntity<Label[]> response = this.rest.exchange(
new RequestEntity<Void>(HttpMethod.DELETE, URI.create(
issue.getLabelsUrl().replace("{/name}", "/" + labelName))),
issue.getLabelsUrl().replace("{/name}", "/" + encodedName))),
Label[].class);
if (response.getStatusCode() != HttpStatus.OK) {
log.warn("Failed to remove label from issue. Response status: "