0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

fix: prevent issue with leading hyphen in package name - fixes #1429 (#1636)

This commit is contained in:
Daniel Ruf 2020-01-03 23:57:21 +01:00 committed by Juan Picado @jotadeveloper
parent fbc87fc26e
commit f89bf27f5a

View file

@ -33,7 +33,7 @@ export function setSecurityWebHeaders(req: $RequestExtend, res: $ResponseExtend,
// flow: express does not match properly
// flow info https://github.com/flowtype/flow-typed/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+express
export function validateName(req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer, value: string, name: string): void {
if (value.charAt(0) === '-') {
if (value === '-') {
// special case in couchdb usually
next('route');
} else if (utilValidateName(value)) {
@ -46,7 +46,7 @@ export function validateName(req: $RequestExtend, res: $ResponseExtend, next: $N
// flow: express does not match properly
// flow info https://github.com/flowtype/flow-typed/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+express
export function validatePackage(req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer, value: string, name: string): void {
if (value.charAt(0) === '-') {
if (value === '-') {
// special case in couchdb usually
next('route');
} else if (utilValidatePackage(value)) {