Skip to content
Snippets Groups Projects
Commit e30a4317 authored by Daniel Neuwirth's avatar Daniel Neuwirth
Browse files
parents f3ff1284 7906228e
Branches Detailinfo
No related tags found
No related merge requests found
...@@ -29,6 +29,7 @@ def raise_validation_error_if_virus_found(filename, upload_file): ...@@ -29,6 +29,7 @@ def raise_validation_error_if_virus_found(filename, upload_file):
def calculate_hash(upload_file): def calculate_hash(upload_file):
upload_file.seek(0)
hash_md5 = hashlib.md5() hash_md5 = hashlib.md5()
for chunk in iter(lambda: upload_file.read(4096), b""): for chunk in iter(lambda: upload_file.read(4096), b""):
hash_md5.update(chunk) hash_md5.update(chunk)
...@@ -41,6 +42,8 @@ def _raise_validation_error_if_hash_values_differ(upload_file, resource): ...@@ -41,6 +42,8 @@ def _raise_validation_error_if_hash_values_differ(upload_file, resource):
if hash_from_resource: if hash_from_resource:
hash_from_calculation = calculate_hash(upload_file) hash_from_calculation = calculate_hash(upload_file)
if not hash_from_calculation == hash_from_resource: if not hash_from_calculation == hash_from_resource:
log.debug('hash from calculation: {}'.format(hash_from_calculation))
log.debug('hash from resource: {}'.format(hash_from_resource))
raise logic.ValidationError({'upload': ['Berechneter Hash und mitgelieferter Hash sind unterschiedlich']}) raise logic.ValidationError({'upload': ['Berechneter Hash und mitgelieferter Hash sind unterschiedlich']})
......
...@@ -111,7 +111,6 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm ...@@ -111,7 +111,6 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
schema['extras'].update({ schema['extras'].update({
'key': [ 'key': [
toolkit.get_converter('known_spatial_uri'), toolkit.get_converter('known_spatial_uri'),
toolkit.get_converter('validate_licenseAttributionByText'),
] ]
}) })
schema.update( schema.update(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment