Redirect broken links to 404 when --no-edit mode is enabled. Resolves #1197.
This commit is contained in:
+8
-3
@@ -524,9 +524,14 @@ module Precious
|
|||||||
elsif file = wiki.file(fullpath, wiki.ref, true)
|
elsif file = wiki.file(fullpath, wiki.ref, true)
|
||||||
show_file(file)
|
show_file(file)
|
||||||
else
|
else
|
||||||
not_found unless @allow_editing
|
if @allow_editing
|
||||||
page_path = [path, join_page_name(name, ext)].compact.join('/')
|
page_path = [path, join_page_name(name, ext)].compact.join('/')
|
||||||
redirect to("/create/#{clean_url(encodeURIComponent(page_path))}")
|
redirect to("/create/#{clean_url(encodeURIComponent(page_path))}")
|
||||||
|
else
|
||||||
|
@message = "The requested page does not exist."
|
||||||
|
status 404
|
||||||
|
return mustache :error
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user