Skip to content

Commit

Permalink
changes default accept type to text/html, */* ; fixed #322
Browse files Browse the repository at this point in the history
  • Loading branch information
huberrob committed Feb 8, 2023
1 parent cf2764c commit eebcffa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions fuji_server/evaluators/fair_evaluator_data_content_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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')),
Expand Down
2 changes: 1 addition & 1 deletion fuji_server/helper/request_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit eebcffa

Please sign in to comment.