Permalink
Browse files

Fake SHA1

  • Loading branch information...
rosylilly committed Oct 22, 2017
1 parent 48bb065 commit b29bc70d6af32c3a66f30f014eb0e2c2750b7461
Showing with 3 additions and 4 deletions.
  1. +3 −4 isubata/webapp/ruby/app.rb
@@ -415,13 +415,12 @@ def user
return 400
end
data = file[:tempfile].read
digest = Digest::SHA1.hexdigest(data)
data = file[:tempfile].read(1024)
digest = Digest::SHA1.hexdigest("#{file[:tempfile].size}.#{data}")
avatar_name = digest + ext
avatar_data = data
path = File.join(icons_dir, avatar_name)
File.write(path, avatar_data) unless File.exists?(path)
FileUtils.cp(file[:tempfile].path, path) unless File.exists?(path)
end
end

0 comments on commit b29bc70

Please sign in to comment.