diff --git a/fuji_server/evaluators/fair_evaluator_data_content_metadata.py b/fuji_server/evaluators/fair_evaluator_data_content_metadata.py index e7bb8068..be4fc1cb 100644 --- a/fuji_server/evaluators/fair_evaluator_data_content_metadata.py +++ b/fuji_server/evaluators/fair_evaluator_data_content_metadata.py @@ -235,7 +235,6 @@ def evaluate(self): #if data_object.get('header_content_type') == data_object.get('type'): # TODO: variation of mime type (text/tsv vs text/tab-separated-values) self.fuji.tika_content_types_list = self.fuji.extend_mime_type_list(self.fuji.tika_content_types_list) - if d == 'type': if data_object.get('type'): if data_object.get('type') in self.fuji.tika_content_types_list: @@ -255,7 +254,14 @@ def evaluate(self): else: try: if data_object.get('size'): - object_size = int(float(data_object.get('size'))) + data_size = data_object.get('size') + try: + dsm = re.match(r"(\d+(?:\.\d+)?)\s*[A-Za-z]*", str(data_size)) + if dsm[1]: + data_size = dsm[1] + except: + pass + object_size = int(float(data_size)) if object_size == int(float(tika_content_size)): matches_content = True matches_size = True @@ -266,6 +272,7 @@ def evaluate(self): str(tika_content_size))) except Exception as e: + print(e) self.logger.warning( '{0} : Could not verify content size from downloaded file -: (expected: {1}, found: {2})' .format(self.metric_identifier, str(data_object.get('size')), diff --git a/fuji_server/helper/request_helper.py b/fuji_server/helper/request_helper.py index 71d8ae71..9c1f3e15 100644 --- a/fuji_server/helper/request_helper.py +++ b/fuji_server/helper/request_helper.py @@ -73,7 +73,7 @@ class AcceptTypes(Enum): rdfxml = 'application/rdf+xml, text/rdf;q=0.5, application/xml;q=0.1, text/xml;q=0.1' turtle = 'text/ttl, text/turtle, application/turtle, application/x-turtle;q=0.6, text/n3;q=0.3, text/rdf+n3;q=0.3, application/rdf+n3;q=0.3' rdf = 'text/turtle, application/turtle, application/x-turtle;q=0.8, application/rdf+xml, text/n3;q=0.9, text/rdf+n3;q=0.9,application/ld+json' - default = 'text/html;q=0.5, */*' + default = 'text/html, */*' @staticmethod def list():