Skip to content

feat(arcgis-rest-request): change getDomainCredentials to handle URLs… #1211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

MikeTschudi
Copy link
Member

… with mismatching cases

#1210

@MikeTschudi MikeTschudi linked an issue Apr 4, 2025 that may be closed by this pull request
@gavinr-maps gavinr-maps requested a review from patrickarlt April 7, 2025 13:37
Comment on lines 1275 to 1277
url = url.toLocaleLowerCase();
return this.trustedDomains.some((domainWithProtocol) => {
return url.startsWith(domainWithProtocol);
return url.startsWith(domainWithProtocol.toLocaleLowerCase());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you using .toLocaleLowerCase() (vs .toLowerCase) intentionally here? I'm wondering what are the potential implications vs using .toLowerCase().

Copy link
Member Author

@MikeTschudi MikeTschudi Apr 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I'd read a comment that toLowerCase may not work properly for locales such as Turkish. I'll ask the translation team for advice.

String.prototype.toLocaleLowerCase():

Unlike other methods that use the locales argument, toLocaleLowerCase() does not allow locale matching. Therefore, after checking the validity of the locales argument, toLocaleLowerCase() always uses the first locale in the list (or the default locale if the list is empty), even if this locale is not supported by the implementation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For domain names (which we are checking here) should it really matter because the character set of so limited I think we can use toLowerCase() here.

Copy link
Contributor

@gavinr-maps gavinr-maps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@MikeTschudi MikeTschudi merged commit d41b00b into main Apr 7, 2025
2 checks passed
@MikeTschudi MikeTschudi deleted the 1210-support-domain-case-insensitivity-in-getdomaincredentials branch April 7, 2025 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support domain case insensitivity in getDomainCredentials
3 participants