Fix loading of archived content with file names containing '#' characters

This commit is contained in:
jdgleaver 2021-06-03 16:40:13 +01:00
parent d8a5505204
commit b5df2b883a

View File

@ -90,12 +90,14 @@ const char *path_get_archive_delim(const char *path)
if (!last_slash)
return NULL;
/* Find delimiter position */
delim = strrchr(last_slash, '#');
if (!delim)
return NULL;
/* Find delimiter position
* > Since filenames may contain '#' characters,
* must loop until we find the first '#' that
* is directly *after* a compression extension */
delim = strchr(last_slash, '#');
while (delim)
{
/* Check whether this is a known archive type
* > Note: The code duplication here is
* deliberate, to maximise performance */
@ -124,6 +126,10 @@ const char *path_get_archive_delim(const char *path)
return delim;
}
delim++;
delim = strchr(delim, '#');
}
return NULL;
}