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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Example how your the webhook in Gogs should look like:
This project has some integration tests available. For more details see the [dedicated readme](about_integration_tests.md).

### Change Log
#### Version 1.0.14 (Apr 4, 2018)
- Fixes `job not found` if slashes are used in branch [[GH_ISSUE#36](https://github.com/jenkinsci/gogs-webhook-plugin/issues/36)/[PR#40](https://github.com/jenkinsci/gogs-webhook-plugin/pull/40)].

#### Version 1.0.13 (Mar 16, 2018)
- Fixes `job not found` if folders are used [[GH_ISSUE#36](https://github.com/jenkinsci/gogs-webhook-plugin/issues/36)/[PR#37](https://github.com/jenkinsci/gogs-webhook-plugin/pull/37)].

Expand Down
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand All @@ -13,7 +14,7 @@

<properties>
<jenkins.version>1.625.3</jenkins.version>
<java.level>7</java.level>
<java.level>8</java.level>
<jenkins-test-harness.version>2.13</jenkins-test-harness.version>
<java.level.test>8</java.level.test>
</properties>
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/org/jenkinsci/plugins/gogs/GogsWebHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ associated documentation files (the "Software"), to deal in the Software without
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;

Expand Down Expand Up @@ -185,7 +187,13 @@ public void doIndex(StaplerRequest req, StaplerResponse rsp) throws IOException
} else {
String ref = (String) jsonObject.get("ref");
String[] components = ref.split("/");
ref = components[components.length - 1];
if (components.length > 3) {
/* refs contains branch/tag with a slash */
List<String> test = Arrays.asList(ref.split("/"));
ref = String.join("%2F", test.subList(2, test.size()));
} else {
ref = components[components.length - 1];
}

job = GogsUtils.find(jobName + "/" + ref, Job.class);

Expand Down