Skip to content

Commit

Permalink
fix: added util for confirming service is not secure proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
abp6318 committed Sep 18, 2024
1 parent 1def175 commit 04b7773
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion packages/common/src/content/hostedServiceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,26 @@ export function isAGOFeatureServiceUrl(url: string): boolean {
// TODO: we should really centralize this regex somewhere
const FEATURE_SERVICE_URL_REGEX = /(feature)server(\/|\/(\d+))?$/i;
return (
!!url && url.includes("arcgis.com") && FEATURE_SERVICE_URL_REGEX.test(url)
!!url &&
url.includes("arcgis.com") &&
FEATURE_SERVICE_URL_REGEX.test(url) &&
!isSecureProxyServiceUrl(url)
);
}

/**
* Portal secure proxy services are identified by looking for these patterns in the `url`:
* - /sharing/servers/
* - /sharing/appservices/
* - /usrsvcs/servers/
* - /usrsvcs/appservices/
*
* @param url
*/
export function isSecureProxyServiceUrl(url: string): boolean {
return /\/(sharing|usrsvcs)\/(appservices|servers)\//i.test(url);
}

export enum ServiceCapabilities {
EXTRACT = "Extract",
QUERY = "Query",
Expand Down

0 comments on commit 04b7773

Please sign in to comment.