diff options
author | Gabriel Fontes <eu@misterio.me> | 2022-03-19 11:04:04 -0300 |
---|---|---|
committer | Gabriel Fontes <eu@misterio.me> | 2022-03-19 11:04:04 -0300 |
commit | 9720797f695f7646744e9cd020fa79679441814f (patch) | |
tree | 05f1fe379c27ef47370a0f83b7192c551dea0b27 /src/libfetchers/github.cc | |
parent | 345a8ee0cb56775c57c3b7da99b0726290241e18 (diff) |
Don't partial match sourcehut refs
Diffstat (limited to 'src/libfetchers/github.cc')
-rw-r--r-- | src/libfetchers/github.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libfetchers/github.cc b/src/libfetchers/github.cc index d52ea649d..58b6e7c04 100644 --- a/src/libfetchers/github.cc +++ b/src/libfetchers/github.cc @@ -399,7 +399,9 @@ struct SourceHutInputScheme : GitArchiveInputScheme std::string line; std::string id; while(getline(is, line)) { - std::regex pattern(ref_uri); + // Append $ to avoid partial name matches + std::regex pattern(fmt("%s$", ref_uri)); + if (std::regex_search(line, pattern)) { id = line.substr(0, line.find('\t')); break; |