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

appservice: Fix containerized function app name validation to exclude uppercase letters #1754

Merged
merged 7 commits into from
Jul 9, 2024

Conversation

motm32
Copy link
Contributor

@motm32 motm32 commented Jul 8, 2024

This is what the name validation on the portal now says:
image

It matches the validation from container apps so using the regular expression from there.

@motm32 motm32 requested a review from a team as a code owner July 8, 2024 17:18
nturinski
nturinski previously approved these changes Jul 8, 2024
@@ -113,6 +113,8 @@ export class SiteNameStep extends AzureNameStep<SiteNameStepWizardContext> {

if (name.length < siteNamingRules.minLength || name.length > siteNamingRules.maxLength) {
return vscode.l10n.t('The name must be between {0} and {1} characters.', siteNamingRules.minLength, siteNamingRules.maxLength);
} else if ((!/^[a-z]([-a-z0-9]*[a-z0-9])?$/.test(name)) && this._siteFor === "containerizedFunctionApp") {
Copy link
Member

Choose a reason for hiding this comment

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

nit: You should check the siteFor property first so the conditional can just abort if it's not a containerized app. It's probably small, but still a wasted check.

nturinski
nturinski previously approved these changes Jul 8, 2024
Copy link
Member

@nturinski nturinski left a comment

Choose a reason for hiding this comment

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

Should go ahead and bump so we can release and add to Functions asap.

@@ -113,6 +113,8 @@ export class SiteNameStep extends AzureNameStep<SiteNameStepWizardContext> {

if (name.length < siteNamingRules.minLength || name.length > siteNamingRules.maxLength) {
return vscode.l10n.t('The name must be between {0} and {1} characters.', siteNamingRules.minLength, siteNamingRules.maxLength);
} else if (this._siteFor === "containerizedFunctionApp" && (!/^[a-z]([-a-z0-9]*[a-z0-9])?$/.test(name))) {
Copy link
Contributor

@MicroFish91 MicroFish91 Jul 8, 2024

Choose a reason for hiding this comment

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

I think the * here might be in the wrong spot, otherwise you can still have multiple -'s together. Here is what I think you had for ContainerAppNameStep!

!/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(name)

Copy link
Contributor Author

@motm32 motm32 Jul 9, 2024

Choose a reason for hiding this comment

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

Oh lol yes I copied this from ManagedEnvironmentNameStep since I figured it was the same since the error message was the same but I can change it.

On another note shouldn't the regex be the same between ContainerAppNameStep and ManagedEnvironmentNameStep since the error message is the same between the two?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah good catch, if the requirements are the same I think we should update that check logic

MicroFish91
MicroFish91 previously approved these changes Jul 9, 2024
@motm32 motm32 merged commit 682442f into main Jul 9, 2024
4 checks passed
@motm32 motm32 deleted the meganmott/fixContainNameValid branch July 9, 2024 17:10
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.

3 participants