Skip to content

Commit 17d67e9

Browse files
committed
Fix bug around endpointId not being identified correctly when a querystring is present on the URL
1 parent daf6860 commit 17d67e9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

share-oauth/src/main/java/org/sharextras/webscripts/connector/HttpOAuth2Connector.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ private OAuth2CredentialVault getCredentialVault(String endpointId, HttpServletR
303303
String userId = getUserId(session);
304304
ConnectorService connectorService = getConnectorService();
305305

306+
// TODO Check that userId is not null, which it will be if the user's session has expired
306307
OAuth2CredentialVault vault = (OAuth2CredentialVault)connectorService.getCredentialVault(session, userId, VAULT_PROVIDER_ID);
307308
if (load)
308309
{
@@ -582,8 +583,10 @@ public String getEndpointId()
582583

583584
private String getEndpointId(String uri, HttpServletRequest request)
584585
{
586+
// Work out URI path (i.e. uri without the querystring portion)
587+
String uriPath = uri.indexOf('?') > -1 ? uri.substring(0, uri.indexOf('?')) : uri;
585588
return getEndpointId() != null ? getEndpointId() :
586-
request.getPathInfo().replaceAll(uri, "").replaceAll("/proxy/", "");
589+
request.getPathInfo().replaceAll(uriPath, "").replaceAll("/proxy/", "");
587590

588591
}
589592

0 commit comments

Comments
 (0)