summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-01-30 14:01:15 +0100
committerwm4 <wm4@nowhere>2018-01-30 14:01:15 +0100
commit7f3c7100d518f5f2fc961275178e04b0cabb5b5c (patch)
tree155dd7622ddbc4fffbeeacadf96e92acc755997e
parenteaa97daf65c659d901cd21139d770a44d4bcdfae (diff)
downloadmpv-7f3c7100d518f5f2fc961275178e04b0cabb5b5c.tar.bz2
mpv-7f3c7100d518f5f2fc961275178e04b0cabb5b5c.tar.xz
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.
-rw-r--r--demux/cue.c12
1 files 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: {