In order to mitigate against the brute force attacks against Gitlab accounts, we are moving to all edu-ID Logins. We would like to remind you to link your account with your edu-id. Login will be possible only by edu-ID after November 30, 2021. Here you can find the instructions for linking your account.

If you don't have a SWITCH edu-ID, you can create one with this guide here

kind regards

This Server has been upgraded to GitLab release 14.2.6

Unverified Commit aadb4805 authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files
parent 3c869126
Pipeline #16821 passed with stages
in 4 minutes and 8 seconds
......@@ -123,9 +123,6 @@ def _get_values_from_digital_object(msg, access_status):
if 'hasMimeType' in msg:
mimetype = msg['hasMimeType']
return_values['mimetype'] = mimetype
# create value for field 'type' form mimetype:
obj_type = mimetype.split('/')[0]
return_values['type'] = obj_type
if 'locator' in msg and '' not in msg['locator']:
uri = msg['locator']
......@@ -147,12 +144,8 @@ def _get_values_from_digital_object(msg, access_status):
duration = msg['duration']
return_values['duration'] = duration
if 'isDistributedOn' in msg:
# //@formatter:off
if uri.startswith('http'):
if not (msg['isDistributedOn'] == 'audio' or msg['isDistributedOn'] == 'image' or
msg['isDistributedOn'] == 'video'):
# // @formatter:on
return_values['type'] = msg['isDistributedOn']
return_values['type'] = msg['isDistributedOn']
if _is_remote_file(uri):
if access_status == 'public':
return_values['proto'] = 'redirect'
......@@ -162,6 +155,16 @@ def _get_values_from_digital_object(msg, access_status):
return return_values
def _is_remote_file(uri):
return uri.startswith('http')
def _is_directly_fetchable(digital_object_resource):
return digital_object_resource['isDistributedOn'] == 'audio' or \
digital_object_resource['isDistributedOn'] == 'image' or \
digital_object_resource['isDistributedOn'] == 'video'
def _get_access_status(graph, record_id):
for resource in graph:
if 'type' in resource and resource['type'] == 'access' and \
......@@ -66,8 +66,9 @@ class Test(TestCase):
res = {
'sig': 'BAB-PA_43-BAB_MC169A-1',
'access': 'public',
'uri': 'rtmp://',
'type': 'audio'
'proto': 'file',
'type': 'audio',
'uri': 'rtmp://'
digital_object = Test._load_file_and_get_res('BAB-PA_43-BAB_MC169A.json',
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment