1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 06:31:14 +02:00

fix: ensure access-token matches are complete

This commit is contained in:
Thomas Bereknyei 2025-02-13 12:45:37 -05:00
parent a9f4d73d3e
commit 269efa01b3
2 changed files with 31 additions and 4 deletions

View file

@ -179,8 +179,15 @@ struct GitArchiveInputScheme : InputScheme
size_t answer_match_len = 0;
if(! url.empty()) {
for (auto & token : tokens) {
auto match_len = url.find(token.first);
if (match_len != std::string::npos && token.first.length() > answer_match_len) {
auto first = url.find(token.first);
if (
first != std::string::npos
&& token.first.length() > answer_match_len
&& first == 0
&& url.substr(0,token.first.length()) == token.first
&& (url.length() == token.first.length() || url[token.first.length()] == '/')
)
{
answer = token.second;
answer_match_len = token.first.length();
}