Skip to content

Commit e5ef130

Browse files
committed
refactor: update key limit to 600 characters
1 parent 5fc85c0 commit e5ef130

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/main.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -609,13 +609,13 @@ describe('set', () => {
609609
})
610610

611611
expect(async () => await blobs.set('kéy', 'value')).rejects.toThrowError(
612-
`Keys can only contain letters, numbers, percentage signs (%), exclamation marks (!), dots (.), asterisks (*), single quotes ('), parentheses (()), dashes (-) and underscores (_) up to a maximum of 800 characters. Keys can also contain forward slashes (/), but must not start with one.`,
612+
`Keys can only contain letters, numbers, percentage signs (%), exclamation marks (!), dots (.), asterisks (*), single quotes ('), parentheses (()), dashes (-) and underscores (_) up to a maximum of 600 characters. Keys can also contain forward slashes (/), but must not start with one.`,
613613
)
614614
expect(async () => await blobs.set('/key', 'value')).rejects.toThrowError(
615-
`Keys can only contain letters, numbers, percentage signs (%), exclamation marks (!), dots (.), asterisks (*), single quotes ('), parentheses (()), dashes (-) and underscores (_) up to a maximum of 800 characters. Keys can also contain forward slashes (/), but must not start with one.`,
615+
`Keys can only contain letters, numbers, percentage signs (%), exclamation marks (!), dots (.), asterisks (*), single quotes ('), parentheses (()), dashes (-) and underscores (_) up to a maximum of 600 characters. Keys can also contain forward slashes (/), but must not start with one.`,
616616
)
617617
expect(async () => await blobs.set('a'.repeat(801), 'value')).rejects.toThrowError(
618-
`Keys can only contain letters, numbers, percentage signs (%), exclamation marks (!), dots (.), asterisks (*), single quotes ('), parentheses (()), dashes (-) and underscores (_) up to a maximum of 800 characters. Keys can also contain forward slashes (/), but must not start with one.`,
618+
`Keys can only contain letters, numbers, percentage signs (%), exclamation marks (!), dots (.), asterisks (*), single quotes ('), parentheses (()), dashes (-) and underscores (_) up to a maximum of 600 characters. Keys can also contain forward slashes (/), but must not start with one.`,
619619
)
620620
})
621621

src/store.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ export class Store {
225225
}
226226

227227
static validateKey(key: string) {
228-
if (key.startsWith('/') || !/^[\w%!.*'()/-]{1,800}$/.test(key)) {
228+
if (key.startsWith('/') || !/^[\w%!.*'()/-]{1,600}$/.test(key)) {
229229
throw new Error(
230-
"Keys can only contain letters, numbers, percentage signs (%), exclamation marks (!), dots (.), asterisks (*), single quotes ('), parentheses (()), dashes (-) and underscores (_) up to a maximum of 800 characters. Keys can also contain forward slashes (/), but must not start with one.",
230+
"Keys can only contain letters, numbers, percentage signs (%), exclamation marks (!), dots (.), asterisks (*), single quotes ('), parentheses (()), dashes (-) and underscores (_) up to a maximum of 600 characters. Keys can also contain forward slashes (/), but must not start with one.",
231231
)
232232
}
233233
}

0 commit comments

Comments
 (0)