@@ -615,22 +615,32 @@ private function listDirectoryAsTurtle($path)
615615 );
616616
617617 foreach ($ listContents as $ item ) {
618-
619- // @FIXME: $item needs to be checked for "describedby" metadata to see if they need Meta Link handling
620- // for instance be added to the file list
621-
622618 switch ($ item ['type ' ]) {
623619 case "file " :
624620 // ACL and meta files should not be listed in directory overview
625621 if (
626622 $ item ['basename ' ] !== '.meta '
627623 && in_array ($ item ['extension ' ], ['acl ' , 'meta ' ]) === false
628624 ) {
629- $ filename = "< " . rawurlencode ($ item ['basename ' ]) . "> " ;
630- $ turtle [$ filename ] = array (
631- "a " => array ("ldp:Resource " )
632- );
633- $ turtle ["<> " ]['ldp:contains ' ][] = $ filename ;
625+ try {
626+ $ linkMetadataResponse = $ this ->handleLinkMetadata (clone $ this ->response , $ item ['path ' ]);
627+ } catch (Exception $ e ) {
628+ // If the link-metadata can not be retrieved for whatever reason, it should just be listed
629+ // The error will surface when the file itself is accessed
630+ $ linkMetadataResponse = null ;
631+ }
632+
633+ if (
634+ $ linkMetadataResponse === null
635+ || in_array ($ linkMetadataResponse ->getStatusCode (), [404 , 410 ]) === false
636+ ) {
637+ /*/ Only files without link-metadata instruction, or with a redirect instruction may be shown /*/
638+ $ filename = "< " . rawurlencode ($ item ['basename ' ]) . "> " ;
639+ $ turtle [$ filename ] = array (
640+ "a " => array ("ldp:Resource " )
641+ );
642+ $ turtle ["<> " ]['ldp:contains ' ][] = $ filename ;
643+ }
634644 }
635645 break ;
636646 case "dir " :
0 commit comments