File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -249,7 +249,7 @@ public function is_file_readable_externally_by_hash($contenthash) {
249249 if ($ contenthash === sha1 ('' )) {
250250 // Files with empty size are either directories or empty.
251251 // We handle these virtually.
252- return true ;
252+ return false ;
253253 }
254254
255255 $ path = $ this ->get_external_path_from_hash ($ contenthash , false );
Original file line number Diff line number Diff line change @@ -86,6 +86,19 @@ public function test_get_remote_path_from_storedfile_returns_external_path_if_du
8686 $ this ->assertEquals ($ expectedpath , $ actualpath );
8787 }
8888
89+ public function test_get_remote_path_from_empty_storedfile_returns_internal_path_if_duplicated_and_preferexternal () {
90+ set_config ('preferexternal ' , true , 'tool_objectfs ' );
91+ $ this ->reset_file_system (); // Needed to load new config.
92+ $ file = $ this ->create_duplicated_file ('' );
93+ $ expectedpath = $ this ->get_local_path_from_storedfile ($ file );
94+
95+ $ reflection = new \ReflectionMethod (object_file_system::class, 'get_remote_path_from_storedfile ' );
96+ $ reflection ->setAccessible (true );
97+ $ actualpath = $ reflection ->invokeArgs ($ this ->filesystem , [$ file ]);
98+
99+ $ this ->assertEquals ($ expectedpath , $ actualpath );
100+ }
101+
89102 public function test_get_local_path_from_hash_will_fetch_remote_if_fetchifnotfound () {
90103 $ file = $ this ->create_remote_file ();
91104 $ filehash = $ file ->get_contenthash ();
You can’t perform that action at this time.
0 commit comments