summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-06-01 22:41:07 +0200
committersfan5 <sfan5@live.de>2023-06-01 22:47:48 +0200
commitc1bef0f084b339b79f7b6551267bf59fe12f9389 (patch)
tree17b700884e5bf9808e7f141dfc3ae0adb542192e /options
parent83acd93c6a48e6b47ca57c2ef4451a97531dc180 (diff)
downloadmpv-c1bef0f084b339b79f7b6551267bf59fe12f9389.tar.bz2
mpv-c1bef0f084b339b79f7b6551267bf59fe12f9389.tar.xz
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.
Diffstat (limited to 'options')
-rw-r--r--options/path.c14
1 files 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;