Skip to content
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

add variable checker to full url checker #1737

Merged
merged 5 commits into from
Nov 12, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/altair-app/src/app/modules/altair/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ export const getFullUrl = (url: string) => {
return url;
}

// regex to test if given string is an environment variable
const regex = /^{{[a-zA-Z._]+}}$/gm;
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are several variable regexes in this file. Might be better to reuse one of them instead of creating a new one.

if (regex.test(url)) {
return url;
}

if (!validUrl.isUri(url)) {
if (url.trim() === '*') {
return location.href;
Expand Down