Skip to content

Commit

Permalink
fix: fix SYLT validation (#502)
Browse files Browse the repository at this point in the history
eidoriantan committed Sep 16, 2022

Verified

This commit was signed with the committer’s verified signature.
eidoriantan Adriane Justine Tan
1 parent 1073318 commit 4550bf9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/id3v2/validate.mjs
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ const setRegex = /^([0-9]+)(\/[0-9]+)?$/
const urlRegex = /^(https?):\/\/[^\s/$.?#]+\.[^\s]*/
const langRegex = /^([a-z]{3}|XXX)$/
const imageRegex = /(image\/[a-z0-9!#$&.+\-^_]+){0,129}/
const syltRegex = /^((\[\d{1,}:\d{2}\.\d{3}\]) ?(.*)|)/
const syltRegex = /^((\[\d{1,}:\d{2}\.\d{3}\]) (.*))/

export function textFrame (value, version, strict) {
if (typeof value !== 'string') {
@@ -469,7 +469,7 @@ export function syltFrame (values, version, strict) {
throw new Error('Format should be either 1 or 2')
}

if (sylt.lyrics.split('\n').every(entry => syltRegex.test(entry))) {
if (!sylt.lyrics.split('\n').every(entry => syltRegex.test(entry))) {
throw new Error('Lyrics must follow this format: [mm:ss.xxx]')
}

0 comments on commit 4550bf9

Please sign in to comment.