Skip to content

Commit

Permalink
Host index.html, if dir contains it
Browse files Browse the repository at this point in the history
  • Loading branch information
apoorv-2204 authored and samuelmanzanera committed Feb 8, 2023
1 parent 319b8e5 commit d3a77f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,15 @@ defmodule ArchethicWeb.API.WebHostingController.Resources do
case Map.get(metadata, resource_path) do
nil ->
if is_a_directory?(metadata, resource_path) do
{:error, :is_a_directory}
index_path = resource_path <> "/index.html"

case Map.get(metadata, index_path) do
nil ->
{:error, :is_a_directory}

file ->
{:ok, file, MIME.from_path("index.html"), index_path}
end
else
# Handle JS History API by serving index.html instead of a 404
# We loose the ability to return real 404 errors
Expand Down
2 changes: 1 addition & 1 deletion src/c/nat/miniupnp

0 comments on commit d3a77f8

Please sign in to comment.