cue: strip quotes and leading whitespace from tags

If tags like TITLE have the whole parameter in " quotes, strip them.
Also remove the leading whitespace, since even with a single space it
was always included.

Fixes #5462.
This commit is contained in:
wm4 2018-01-30 14:01:15 +01:00
parent eaa97daf65
commit 7f3c7100d5
1 changed files with 10 additions and 2 deletions

View File

@ -75,7 +75,7 @@ static enum cue_command read_cmd(struct bstr *data, struct bstr *out_params)
if (rest.len && !strchr(WHITESPACE, rest.start[0]))
continue;
if (out_params)
*out_params = rest;
*out_params = bstr_lstrip(rest);
return cue_command_strings[n].command;
}
}
@ -105,6 +105,14 @@ static char *read_quoted(void *talloc_ctx, struct bstr *data)
return bstrto0(talloc_ctx, res);
}
static struct bstr strip_quotes(struct bstr data)
{
bstr s = data;
if (bstr_eatstart0(&s, "\"") && bstr_eatend0(&s, "\""))
return s;
return data;
}
// Read a 2 digit unsigned decimal integer.
// Return -1 on failure.
static int read_int_2(struct bstr *data)
@ -193,7 +201,7 @@ struct cue_file *mp_parse_cue(struct bstr data)
[CUE_PERFORMER] = "performer",
};
struct mp_tags *tags = cur_track ? cur_track->tags : f->tags;
mp_tags_set_bstr(tags, bstr0(metanames[cmd]), param);
mp_tags_set_bstr(tags, bstr0(metanames[cmd]), strip_quotes(param));
break;
}
case CUE_INDEX: {