mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
[validation-tools] eventName: accept upper case letters (#36188)
GitOrigin-RevId: 979ec5c744d5304232d447ff5fff076ee081721f
This commit is contained in:
@@ -781,7 +781,13 @@ describe('zodHelpers', () => {
|
||||
expect(parsed.data).toBe('editor-click_something-2')
|
||||
})
|
||||
|
||||
it('fails to parse a name containing an uppercase letter or dots, colons, semicolons, commas and slashes', () => {
|
||||
it('parses successfully when provided a name with upper case letter', () => {
|
||||
const parsed = zz.eventName().safeParse('For-Pages')
|
||||
expect(parsed.success).toBe(true)
|
||||
expect(parsed.data).toBe('For-Pages')
|
||||
})
|
||||
|
||||
it('fails to parse a name containing dots, colons, semicolons, commas and slashes', () => {
|
||||
const parsed = zz.eventName().safeParse('I.did:something,here/now;too')
|
||||
expect(parsed.success).toBe(false)
|
||||
expect(parsed.error?.issues).toMatchObject([
|
||||
|
||||
@@ -194,7 +194,7 @@ const zz = {
|
||||
* call site of recordEventForSession/recordEventForUser/
|
||||
* recordEventForMongoUser in web's app/, modules/ and scripts/ -- is
|
||||
* already kebab-case or snake_case, i.e. already matches
|
||||
* `^[a-z0-9-_]+$`. Capped at 240 characters, well above the longest of
|
||||
* `/^[a-z0-9-_]+$/i`. Capped at 240 characters, well above the longest of
|
||||
* those literals. AnalyticsManager's own _isAttributeValid applies a
|
||||
* wider regex, but that's a separate, looser backend-only guard for call
|
||||
* sites that don't go through one of these schemas -- not evidence that a
|
||||
@@ -204,7 +204,7 @@ const zz = {
|
||||
z
|
||||
.string()
|
||||
.min(1, { message: 'invalid event name' })
|
||||
.regex(/^[a-z0-9-_]+$/, { message: 'invalid event name' })
|
||||
.regex(/^[a-zA-Z0-9-_]+$/, { message: 'invalid event name' })
|
||||
.max(240, { message: 'event name is too long' }),
|
||||
/**
|
||||
* For endpoints that consume the request as a raw stream (e.g. blob
|
||||
|
||||
Reference in New Issue
Block a user