Commit 067b1acb authored by Cool Fire's avatar Cool Fire

Work around missing functions in Ruby 2.3

parent 2d012a49
......@@ -5,7 +5,7 @@ class HashDbApi < Sinatra::Base
get '/v1/md5/:hash' do
# Check if it is a valid md5 hash
params['hash'].downcase!
halt 400 unless /^[0-9a-f]{32}$/.match? params['hash']
halt 400 if /^[0-9a-f]{32}$/.match(params['hash']).nil?
# Attache to md5.db
db = LevelDB::DB.new "#{settings.database_prefix}md5.db"
......@@ -23,7 +23,7 @@ class HashDbApi < Sinatra::Base
get '/v1/sha1/:hash' do
# Check if it is a valid md5 hash
params['hash'].downcase!
halt 400 unless /^[0-9a-f]{40}$/.match? params['hash']
halt 400 if /^[0-9a-f]{40}$/.match(params['hash']).nil?
# Attache to md5.db
db = LevelDB::DB.new "#{settings.database_prefix}sha1.db"
......@@ -41,7 +41,7 @@ class HashDbApi < Sinatra::Base
get '/v1/sha256/:hash' do
# Check if it is a valid md5 hash
params['hash'].downcase!
halt 400 unless /^[0-9a-f]{64}$/.match? params['hash']
halt 400 unless /^[0-9a-f]{64}$/.match(params['hash']).nil?
# Attache to md5.db
db = LevelDB::DB.new "#{settings.database_prefix}sha256.db"
......
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