security: hide draft posts from public detail endpoint

Add post.draft? check to GET /api/volumen/posts/:slug so guessing a
draft slug returns 404 like the list endpoint already does.
This commit is contained in:
2026-06-25 22:06:49 +02:00
parent 1ca0212197
commit 263e794669
2 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ module Volumen
app.get "/api/volumen/posts/:slug" do
post = store.find(params["slug"], lang: params["lang"])
halt(404, json("error" => "not_found")) if post.nil?
halt(404, json("error" => "not_found")) if post.nil? || post.draft?
json(post.detail)
end