Skip to content

Commit

Permalink
chore: Update webpage name validation check (#978)
Browse files Browse the repository at this point in the history
Co-authored-by: amitjoshi <[email protected]>
  • Loading branch information
amitjoshi438 and amitjoshi committed Jun 17, 2024
1 parent a256808 commit 6a61876
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
"Choose page template": "Choose page template",
"Choose parent page": "Choose parent page",
"Please enter a name for the webpage.": "Please enter a name for the webpage.",
"Webpage names should contain only letters, numbers, hyphens, or underscores.": "Webpage names should contain only letters, numbers, hyphens, or underscores.",
"A webpage with the same name already exists. Please enter a different name.": "A webpage with the same name already exists. Please enter a different name.",
"No parent pages found for adding webfile": "No parent pages found for adding webfile",
"File(s) already exist. No new files to add": "File(s) already exist. No new files to add",
Expand Down
3 changes: 3 additions & 0 deletions loc/translations-export/vscode-powerplatform.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,9 @@ The {3} represents Dataverse Environment's Organization ID (GUID)</note>
<trans-unit id="++CODE++e433d73a7af9f003527cded50fa779687d0f923efc1beb323c3c75fd7062899f">
<source xml:lang="en">Webfile(s) added successfully</source>
</trans-unit>
<trans-unit id="++CODE++00dc171124ab430bbbaae51ec39dda1c5e7d045f382f56b1767d9e733292731c">
<source xml:lang="en">Webpage names should contain only letters, numbers, hyphens, or underscores.</source>
</trans-unit>
<trans-unit id="++CODE++e4bb03b399c07eeda658d87305435a58818cb5e0c3b76ae054d99564cf14ef6b">
<source xml:lang="en">What do you need help with?</source>
</trans-unit>
Expand Down
3 changes: 3 additions & 0 deletions src/client/power-pages/create/Webpage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ async function getWebpageInputs(
if (!name) {
return vscode.l10n.t("Please enter a name for the webpage.");
}
if (!/^[A-Za-z0-9-_]+$/.test(name)) {
return vscode.l10n.t("Webpage names should contain only letters, numbers, hyphens, or underscores.");
}
if (
webpageNames
.map((n) => n.toLowerCase())
Expand Down

0 comments on commit 6a61876

Please sign in to comment.