diff --git a/ckanext/odsh/lib/uploader.py b/ckanext/odsh/lib/uploader.py index d2b24ba8d004e3e55cca526a813e124a17f5a1ce..ab89260a54cada77b3de43f81834e2ab600bd67f 100644 --- a/ckanext/odsh/lib/uploader.py +++ b/ckanext/odsh/lib/uploader.py @@ -29,6 +29,7 @@ def _raise_validation_error_if_virus_found(filename, upload_file): def calculate_hash(upload_file): + upload_file.seek(0) hash_md5 = hashlib.md5() for chunk in iter(lambda: upload_file.read(4096), b""): hash_md5.update(chunk) @@ -41,6 +42,8 @@ def _raise_validation_error_if_hash_values_differ(upload_file, resource): if hash_from_resource: hash_from_calculation = calculate_hash(upload_file) 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']})