fix: Store#save writes non-default language posts into lang subdirectory

default_path_for now routes posts whose lang differs from default_lang
into content_dir/<lang>/<slug>.md, matching the documented multi-language
layout and preventing same-slug posts in different languages from
overwriting each other.
This commit is contained in:
2026-06-25 22:06:49 +02:00
parent afd8ab4bfb
commit ce57410044
2 changed files with 18 additions and 1 deletions
+3 -1
View File
@@ -97,7 +97,9 @@ module Volumen
end
def default_path_for(post)
target = File.join(@content_dir, "#{post.slug}.md")
dir = @content_dir
dir = File.join(dir, post.lang) if post.lang && post.lang != @default_lang
target = File.join(dir, "#{post.slug}.md")
unless File.expand_path(target).start_with?(File.expand_path(@content_dir) + File::SEPARATOR)
raise ArgumentError, "slug escapes content directory"
end