gitlab-org--gitlab-foss/lib/gitlab/ci/external/file/remote.rb

26 lines
460 B
Ruby
Raw Normal View History

module Gitlab
module Ci
module External
module File
class Remote
attr_reader :value
def initialize(value)
@value = value
end
def valid?
::Gitlab::UrlSanitizer.valid?(value) && content
end
def content
HTTParty.get(value)
rescue HTTParty::Error, Timeout::Error
false
end
end
end
end
end
end