From 7f3c7100d518f5f2fc961275178e04b0cabb5b5c Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 30 Jan 2018 14:01:15 +0100 Subject: 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. --- demux/cue.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/demux/cue.c b/demux/cue.c index 9dbde71062..216fe20c1a 100644 --- a/demux/cue.c +++ b/demux/cue.c @@ -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: { -- cgit v1.2.3