fix: fix CSM-016 for real (previous commit was 015)

This commit is contained in:
2026-05-09 17:18:32 +02:00
parent f1de11a205
commit ce80f28e60
11 changed files with 35 additions and 20 deletions

View File

@@ -25,18 +25,24 @@ defmodule BDS.Rendering.FileSystem do
raise Liquex.Error, message: "Illegal template path '#{template_path}'"
true ->
filename = ensure_liquid_ext(normalized_path)
root_paths
|> Enum.map(&Path.expand(Path.join(&1, normalized_path <> ".liquid")))
|> Enum.map(&Path.expand(Path.join(&1, filename)))
|> Enum.find(&File.regular?/1)
|> case do
nil ->
Path.expand(Path.join(List.first(root_paths) || ".", normalized_path <> ".liquid"))
Path.expand(Path.join(List.first(root_paths) || ".", filename))
path ->
path
end
end
end
defp ensure_liquid_ext(path) do
if Path.extname(path) == ".liquid", do: path, else: path <> ".liquid"
end
end
defimpl Liquex.FileSystem, for: BDS.Rendering.FileSystem do