util/UriExtract: remove the query string at the beginning of uri_get_suffix()
This commit is contained in:
parent
2a9131498f
commit
bab626c325
@ -120,11 +120,19 @@ uri_get_path(std::string_view uri) noexcept
|
|||||||
return uri;
|
return uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gcc_pure
|
||||||
|
static StringView
|
||||||
|
UriWithoutQueryString(StringView uri) noexcept
|
||||||
|
{
|
||||||
|
return uri.Split('?').first;
|
||||||
|
}
|
||||||
|
|
||||||
/* suffixes should be ascii only characters */
|
/* suffixes should be ascii only characters */
|
||||||
std::string_view
|
std::string_view
|
||||||
uri_get_suffix(std::string_view _uri) noexcept
|
uri_get_suffix(std::string_view _uri) noexcept
|
||||||
{
|
{
|
||||||
StringView uri(_uri);
|
const auto uri = UriWithoutQueryString(_uri);
|
||||||
|
|
||||||
const char *dot = uri.FindLast('.');
|
const char *dot = uri.FindLast('.');
|
||||||
if (dot == nullptr || dot == uri.data ||
|
if (dot == nullptr || dot == uri.data ||
|
||||||
dot[-1] == '/' || dot[-1] == '\\')
|
dot[-1] == '/' || dot[-1] == '\\')
|
||||||
@ -135,8 +143,7 @@ uri_get_suffix(std::string_view _uri) noexcept
|
|||||||
/* this was not the last path segment */
|
/* this was not the last path segment */
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
/* remove the query string */
|
return suffix;
|
||||||
return suffix.Split('?').first;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
Loading…
Reference in New Issue
Block a user