@@ -604,6 +604,9 @@ def _metadata_dict_with_id(entity_id: str) -> dict:
604604 "s3://bucket/key" ,
605605 "https://example.org/data.txt" ,
606606 "arcp://name,foo/bar" ,
607+ # `file://` URIs with a (non-local) authority denote files living on
608+ # another host (RFC 8089), so they are remote too.
609+ "file://gs02r3b58-ib0/scratch/tmp/5190874/tmp_rf_samples_slt86rc0" ,
607610 # scheme-only absolute URIs (no authority; RO-Crate 1.1 § 4.2.2 + RFC 3986)
608611 "urn:doi:10.5281/zenodo.1234" ,
609612 "doi:10.5281/zenodo.1234" ,
@@ -627,3 +630,30 @@ def test_absolute_uri_data_entity_is_classified_as_remote(entity_id):
627630 assert entity not in crate .metadata .get_data_entities (exclude_web_data_entities = True ), (
628631 f"Entity '{ entity_id } ' should be excluded from local-only data entities"
629632 )
633+
634+
635+ @pytest .mark .parametrize (
636+ "entity_id" ,
637+ [
638+ # `file://` URIs without an authority (RFC 8089) or with the special
639+ # `localhost` authority refer to the local machine, so they describe
640+ # local payload members that the must/4 check must still verify.
641+ "file:///absolute/path/to/file.txt" ,
642+ "file://localhost/absolute/path/to/file.txt" ,
643+ ],
644+ )
645+ def test_local_file_uri_data_entity_is_not_remote (entity_id ):
646+ """
647+ `file://` Data Entity identifiers that point to the local machine (empty or
648+ `localhost` authority) MUST NOT be treated as remote/web-based: only
649+ `file://<host>/...` URIs with a real host are remote (issue #176 follow-up).
650+ """
651+ crate = ROCrate .from_metadata_dict (_metadata_dict_with_id (entity_id ))
652+ entity = crate .metadata .get_entity (entity_id )
653+ assert entity is not None , "Entity should be present in the metadata"
654+ assert not entity .is_remote (), (
655+ f"Entity with local file URI '{ entity_id } ' should NOT be classified as remote"
656+ )
657+ assert entity not in crate .metadata .get_web_data_entities (), (
658+ f"Entity '{ entity_id } ' should not be listed as a web data entity"
659+ )
0 commit comments