File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -306,7 +306,7 @@ defmodule ExDoc.Formatter.HTML do
306306
307307 is_binary ( dir_or_files ) and File . dir? ( dir_or_files ) ->
308308 dir_or_files
309- |> File . cp_r! ( target_dir )
309+ |> File . cp_r! ( target_dir , dereference_symlinks: true )
310310 |> Enum . map ( & Path . relative_to ( & 1 , output ) )
311311
312312 is_binary ( dir_or_files ) ->
Original file line number Diff line number Diff line change @@ -816,4 +816,24 @@ defmodule ExDoc.Formatter.HTMLTest do
816816 after
817817 File . rm_rf! ( "test/tmp/html_assets" )
818818 end
819+
820+ test "symbolic links in the assets should be resolved and copied as actual files" ,
821+ % { tmp_dir: tmp_dir } = context do
822+ File . mkdir_p! ( "test/tmp/html_assets/hello" )
823+ File . touch! ( "test/tmp/html_assets/hello/world" )
824+
825+ File . ln_s ( "world" , "test/tmp/html_assets/hello/symlink_world" )
826+
827+ generate_docs (
828+ doc_config ( context ,
829+ assets: % { "test/tmp/html_assets" => "assets" }
830+ )
831+ )
832+
833+ assert File . regular? ( tmp_dir <> "/html/assets/hello/world" )
834+ assert File . exists? ( tmp_dir <> "/html/assets/hello/symlink_world" )
835+ assert File . read_link ( tmp_dir <> "/html/assets/hello/symlink_world" ) == { :error , :einval }
836+ after
837+ File . rm_rf! ( "test/tmp/html_assets" )
838+ end
819839end
You can’t perform that action at this time.
0 commit comments