forked from lix-project/lix
isAllowedURI: Format
This commit is contained in:
parent
6cbba914a7
commit
1fa958dda1
|
@ -605,11 +605,14 @@ bool isAllowedURI(std::string_view uri, const Strings & allowedUris)
|
||||||
prefix. Thus, the prefix https://github.co does not permit
|
prefix. Thus, the prefix https://github.co does not permit
|
||||||
access to https://github.com. */
|
access to https://github.com. */
|
||||||
for (auto & prefix : allowedUris) {
|
for (auto & prefix : allowedUris) {
|
||||||
if (uri == prefix ||
|
if (uri == prefix
|
||||||
(uri.size() > prefix.size()
|
// Allow access to subdirectories of the prefix.
|
||||||
|
|| (uri.size() > prefix.size()
|
||||||
&& prefix.size() > 0
|
&& prefix.size() > 0
|
||||||
&& hasPrefix(uri, prefix)
|
&& hasPrefix(uri, prefix)
|
||||||
&& (prefix[prefix.size() - 1] == '/' || uri[prefix.size()] == '/')))
|
&& (
|
||||||
|
prefix[prefix.size() - 1] == '/'
|
||||||
|
|| uri[prefix.size()] == '/')))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue