From c1bef0f084b339b79f7b6551267bf59fe12f9389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Thu, 1 Jun 2023 22:41:07 +0200 Subject: [PATCH] path: handle URLs consistently in mp_basename Detect URLs and skip DOS path processing as it is likely to do unexpected thing when ":" is found. --- options/path.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/options/path.c b/options/path.c index 8975291d88..95a79a94b1 100644 --- a/options/path.c +++ b/options/path.c @@ -232,12 +232,14 @@ char *mp_basename(const char *path) char *s; #if HAVE_DOS_PATHS - s = strrchr(path, '\\'); - if (s) - path = s + 1; - s = strrchr(path, ':'); - if (s) - path = s + 1; + if (!mp_is_url(bstr0(path))) { + s = strrchr(path, '\\'); + if (s) + path = s + 1; + s = strrchr(path, ':'); + if (s) + path = s + 1; + } #endif s = strrchr(path, '/'); return s ? s + 1 : (char *)path;