Skip to content

Commit ffb8b16

Browse files
committed
fix: if mimetype not available, check suffix for detecting DC data
1 parent 224e98c commit ffb8b16

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
1.0.8
2+
- fix: if mimetype not available, check suffix for detecting DC data
23
- tests: own the docker image
34
1.0.7
45
- docs: rename shapeout to dcscope

ckanext/dc_serve/serve.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,16 @@ def dcserv(context, data_dict=None):
150150
@functools.lru_cache(maxsize=1024)
151151
def is_dc_resource(res_id) -> bool:
152152
resource = model.Resource.get(res_id)
153-
return resource.mimetype in DC_MIME_TYPES
153+
rs_name = resource.name
154+
is_dc = (
155+
# DCOR says this is a DC resource
156+
resource.mimetype in DC_MIME_TYPES
157+
# The suffix indicates that this is a DC resource
158+
# (in case ckanext-dcor_schemas has not yet updated the metadata)
159+
or (rs_name.count(".")
160+
and rs_name.rsplit(".", 1)[-1] in ["dc", "rtdc"])
161+
)
162+
return is_dc
154163

155164

156165
def get_resource_basins_dicts_private(resource_id):

0 commit comments

Comments
 (0)