fix: Referer URL validation (#4309)

Fixes #354
This commit is contained in:
Muhsin Keloth
2022-03-30 14:36:22 +05:30
committed by GitHub
parent bfe6324d9a
commit 24b20c10ce
6 changed files with 52 additions and 10 deletions

11
lib/url_helper.rb Normal file
View File

@@ -0,0 +1,11 @@
require 'uri'
module UrlHelper
def url_valid?(url)
url = begin
URI.parse(url)
rescue StandardError
false
end
url.is_a?(URI::HTTP) || url.is_a?(URI::HTTPS)
end
end