     end
   end
 
-  defp allowed?(_only, _prefix, []), do: false
+  # null directory is allowed here
+  defp allowed?(_only, _prefix, nil), do: false
+  defp allowed?(_only, _prefix, []), do: true
   defp allowed?([], [], _list), do: true
   defp allowed?(only, prefix, [h|_]) do
     h in only or match?({0, _}, prefix != [] and :binary.match(h, prefix))
   end
 
   defp serve_directory_listing({:ok, conn, _file_info, path}, at, segments) do
+    segments =
+      # rewrite null segments to "/"
+      case segments do
+        [] -> ["/"]
+        other -> other
+      end
     basepath = Path.join("/", Path.join(Path.join(at), Path.join(segments)))
     conn
     |> put_resp_header("content-type", "text/html")

    end
  end

  # XXX: should this code be like this? Isn't File module function sufficient?
  defp directory_file_info(path) do
    case :prim_file.read_file_info(path) do
      {:ok, file_info(type: :directory) = file_info} ->

the directory listing for a specific directory, use the file
system path.

If a static asset directory specified is not found, `PlugStaticLs`
simply forwards the connection to the rest of the pipeline.
If the directory is found, `PlugStaticLs` verifies the path
given in `conn.path_info` and the path must be a subset of `:at` path
for showing the directory listing; otherwise `PlugStaticLs`
forwards the connection to the rest of the pipeline.

## Options

