From 4d60f35162f922c3e47c21943892f31d9c4d5620 Mon Sep 17 00:00:00 2001 From: Mathias Kaufmann Date: Tue, 21 Apr 2020 14:06:30 +0200 Subject: [PATCH] Clumsy method to check for Location and location header. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit HTTP headers are case insensitive. Thus a check should lowercase all keys before checking. Hadn’t enough time yet. --- .../remoteJob/QueueItem.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jenkinsci/plugins/ParameterizedRemoteTrigger/remoteJob/QueueItem.java b/src/main/java/org/jenkinsci/plugins/ParameterizedRemoteTrigger/remoteJob/QueueItem.java index 3026de2c..984ed94a 100644 --- a/src/main/java/org/jenkinsci/plugins/ParameterizedRemoteTrigger/remoteJob/QueueItem.java +++ b/src/main/java/org/jenkinsci/plugins/ParameterizedRemoteTrigger/remoteJob/QueueItem.java @@ -14,7 +14,8 @@ */ public class QueueItem { - final static private String key = "Location"; + final static private String key = "location"; + final static private String keyCs = "Location"; @Nonnull private final String location; @@ -25,9 +26,14 @@ public class QueueItem public QueueItem(@Nonnull Map> header) throws AbortException { - if (!header.containsKey(key)) - throw new AbortException(String.format("Error triggering the remote job. The header of the response has an unexpected format: %n%s", header)); - location = header.get(key).get(0); + if (!header.containsKey(key)) { + if (!header.containsKey(keyCs)) + throw new AbortException(String.format("Error triggering the remote job. The header of the response has an unexpected format: %n%s", header)); + location = header.get(keyCs).get(0); + } else { + location = header.get(key).get(0); + } + try { String loc = location.substring(0, location.lastIndexOf('/')); id = loc.substring(loc.lastIndexOf('/')+1);