Skip to content

Commit

Permalink
Merge pull request #185 from VisLab/check-name-characters
Browse files Browse the repository at this point in the history
Check if extension tag has valid name (allow UTF-8)
  • Loading branch information
VisLab authored Sep 4, 2024
2 parents 397203a + fa7e4b0 commit ffb6125
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions validator/event/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ParsedHedTag } from '../../parser/parsedHedTag'
import { generateIssue, Issue } from '../../common/issues/issues'
import { Schemas } from '../../common/schema/types'

const NAME_CLASS_REGEX = /^[\w\-\u0080-\uFFFF]+$/
const uniqueType = 'unique'
const requiredType = 'required'
const requireChildType = 'requireChild'
Expand Down Expand Up @@ -254,6 +255,8 @@ export class HedValidator {
} else if (!isExtensionAllowedTag) {
// This is not a valid tag.
this.pushIssue('invalidTag', { tag: tag })
} else if (!NAME_CLASS_REGEX.test(tag._remainder)) {
this.pushIssue('invalidTag', { tag: tag })
} else if (!this.options.isEventLevel && this.options.checkForWarnings) {
// This is an allowed extension.
this.pushIssue('extension', { tag: tag })
Expand Down

0 comments on commit ffb6125

Please sign in to comment.