lib/utopia/middleware/content.rb in utopia-0.9.24 vs lib/utopia/middleware/content.rb in utopia-0.9.25
- old
+ new
@@ -113,10 +113,16 @@
# Check if the request is to a non-specific index.
name, extensions = path.basename.split(".", 2)
directory_path = File.join(@root, path.dirname.components, name)
if File.directory? directory_path
- return [307, {"Location" => path.dirname.join([name, "index.#{extensions}"]).to_s}, []]
+ if extensions
+ index_path = [name, "index.#{extensions}"]
+ else
+ index_path = [name, "index"]
+ end
+
+ return [307, {"Location" => path.dirname.join(index_path).to_s}, []]
end
# Otherwise look up the node
node = lookup_node(path)