Skip to content

Commit

Permalink
Fix truncating database name
Browse files Browse the repository at this point in the history
  • Loading branch information
bakerkretzmar committed Jun 26, 2024
1 parent c04e092 commit 0fd2433
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function tap<T>(value: any, interceptor: (v: any) => T) {
export function normalizeDatabaseName(input: string) {
return input
.replace(/[\W_]+/g, '_')
.substring(0, 64)
.substring(0, 63)
.replace(/^_|_$/g, '')
.toLowerCase();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/lib.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('normalizeDatabaseName', () => {
['one! two? three 0x995', 'one_two_three_0x995'],
['jbk/px-454', 'jbk_px_454'],
["please+don't %20 do / this", 'please_don_t_20_do_this'],
['a'.repeat(65), 'a'.repeat(64)],
['a'.repeat(65), 'a'.repeat(63)],
['FOO bar', 'foo_bar'],
])('%s → %s', (input, output) => {
expect(normalizeDatabaseName(input)).toBe(output);
Expand Down

0 comments on commit 0fd2433

Please sign in to comment.