diff --git a/server/api/registry/org/[org]/packages.get.ts b/server/api/registry/org/[org]/packages.get.ts index c9b621015e..30f88fba67 100644 --- a/server/api/registry/org/[org]/packages.get.ts +++ b/server/api/registry/org/[org]/packages.get.ts @@ -1,8 +1,8 @@ import { CACHE_MAX_AGE_ONE_HOUR, NPM_REGISTRY } from '#shared/utils/constants' import { FetchError } from 'ofetch' -// Validation pattern for npm org names (alphanumeric with hyphens) -const NPM_ORG_NAME_RE = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i +// Validation pattern for npm org names - url-sage symbold and not start with a dot (incl. ~test24214. or -ex~-) +const NPM_ORG_NAME_RE = /^[\w~-][\w.~-]*$/ function validateOrgName(name: string): void { if (!name || name.length > 50 || !NPM_ORG_NAME_RE.test(name)) {