Skip to content

Commit ab85831

Browse files
committed
command: keep full URLs in the filename property
When the currently playing file is a URL, don't extract its basename, because the domain and path segments before the last are useful information. Fixes half of #10975.
1 parent 233e896 commit ab85831

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

player/command.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,12 +523,16 @@ static int mp_property_filename(void *ctx, struct m_property *prop,
523523
MPContext *mpctx = ctx;
524524
if (!mpctx->filename)
525525
return M_PROPERTY_UNAVAILABLE;
526+
526527
char *filename = talloc_strdup(NULL, mpctx->filename);
527-
if (mp_is_url(bstr0(filename)))
528-
mp_url_unescape_inplace(filename);
529-
char *f = (char *)mp_basename(filename);
530-
if (!f[0])
528+
char *f;
529+
if (mp_is_url(bstr0(filename))) {
531530
f = filename;
531+
mp_url_unescape_inplace(f);
532+
} else {
533+
f = mp_basename(filename);
534+
}
535+
532536
if (action == M_PROPERTY_KEY_ACTION) {
533537
struct m_property_action_arg *ka = arg;
534538
if (strcmp(ka->key, "no-ext") == 0) {

0 commit comments

Comments
 (0)