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.
This commit is contained in:
Kacper Michajłow 2023-06-01 22:41:07 +02:00 committed by sfan5
parent 83acd93c6a
commit c1bef0f084
1 changed files with 8 additions and 6 deletions

View File

@ -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;