Commit 60c64b76 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add checksum for uploaded maven packages [ci skip]

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 43d1416a
......@@ -146,8 +146,18 @@ module API
end
if format
# TODO: Validate our checksum with Maven.
no_content!
# TODO: Extract in separate method
if format == 'sha1'
package_file = package.package_files.recent.find_by!(file_name: file_name)
stored_sha1 = Digest::SHA256.hexdigest(package_file.file_sha1)
expected_sha1 = uploaded_file.sha256
if stored_sha1 == expected_sha1
no_content!
else
conflict!
end
end
else
file_params = {
file: uploaded_file,
......
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