mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-20 15:19:16 +00:00
fix(plugins): align package path contract validation
This commit is contained in:
1 parent
2a8dba4818
commit
ce3bde5ee4
7 files changed
+52
-12
No files matched your search
@@ -11,6 +11,11 @@ export function assertSafePackagePath(input: string): string {
|
||||
if (!input || input !== input.normalize("NFC")) {
|
||||
throw new Error(`Package path must be non-empty NFC text: ${JSON.stringify(input)}`);
|
||||
}
|
||||
if ([...input].length > PACKAGE_LIMITS.pathCharacters) {
|
||||
throw new Error(
|
||||
`Package path exceeds ${PACKAGE_LIMITS.pathCharacters} Unicode characters: ${input}`,
|
||||
);
|
||||
}
|
||||
if (Buffer.byteLength(input, "utf8") > PACKAGE_LIMITS.pathBytes) {
|
||||
throw new Error(`Package path exceeds ${PACKAGE_LIMITS.pathBytes} UTF-8 bytes: ${input}`);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user