Deduplicate component resolution probes

This commit is contained in:
udo
2026-07-18 06:46:21 +00:00
parent f745ce9413
commit 0517f06925
2 changed files with 12 additions and 5 deletions
+8 -3
View File
@@ -2244,17 +2244,22 @@ private:
if(current_dir != "" && current_dir != entry_dir)
bases.push_back(current_dir + "/");
}
bases.push_back(worker.cfg.site_root + "/");
String site_base = worker.cfg.site_root + "/";
if(std::find(bases.begin(), bases.end(), site_base) == bases.end())
bases.push_back(site_base);
String normalized_file_name = normalize_component_path(file_name);
for(auto& base : bases)
{
std::vector<String> candidates;
candidates.push_back(base + file_name);
candidates.push_back(base + normalize_component_path(file_name));
if(normalized_file_name != file_name)
candidates.push_back(base + normalized_file_name);
if(file_name.rfind("components/", 0) != 0 && base != "")
{
candidates.push_back(base + "components/" + file_name);
candidates.push_back(base + "components/" + normalize_component_path(file_name));
if(normalized_file_name != file_name)
candidates.push_back(base + "components/" + normalized_file_name);
}
for(auto& candidate : candidates)
{