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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user