You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2021/11/18 11:30:30 UTC
[sling-org-apache-sling-testing-clients] branch master updated: SLING-10925 - OsgiConsoleClient breaks if response Location header is an absolute URL
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-clients.git
The following commit(s) were added to refs/heads/master by this push:
new 885c924 SLING-10925 - OsgiConsoleClient breaks if response Location header is an absolute URL
885c924 is described below
commit 885c924bac6df9b2aa53f4f6501c421768862006
Author: Jose Antonio Insua <un...@gmail.com>
AuthorDate: Thu Nov 18 12:30:24 2021 +0100
SLING-10925 - OsgiConsoleClient breaks if response Location header is an absolute URL
Make OsgiConsoleClient.editConfiguration() more robust (#24)
---
.../org/apache/sling/testing/clients/osgi/OsgiConsoleClient.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/sling/testing/clients/osgi/OsgiConsoleClient.java b/src/main/java/org/apache/sling/testing/clients/osgi/OsgiConsoleClient.java
index 842015b..b5119c9 100644
--- a/src/main/java/org/apache/sling/testing/clients/osgi/OsgiConsoleClient.java
+++ b/src/main/java/org/apache/sling/testing/clients/osgi/OsgiConsoleClient.java
@@ -461,7 +461,10 @@ public class OsgiConsoleClient extends SlingClient {
Header[] locationHeader = resp.getHeaders("Location");
if (locationHeader!=null && locationHeader.length==1) {
- return locationHeader[0].getValue().substring(URL_CONFIGURATION.length()+1);
+ // The location header can contain a relative or an absolute URL
+ // Gathering where the URL_CONFIGURATION substring starts will allow adapting to both cases
+ int urlPathStart = locationHeader[0].getValue().indexOf(URL_CONFIGURATION);
+ return locationHeader[0].getValue().substring(urlPathStart + URL_CONFIGURATION.length() + 1);
} else {
return null;
}