debian-mirror-gitlab/lib/api/helpers/sse_helpers.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
375 B
Ruby
Raw Normal View History

2021-02-22 17:27:13 +05:30
# frozen_string_literal: true
module API
module Helpers
module SSEHelpers
def request_from_sse?(project)
return false if request.referer.blank?
uri = URI.parse(request.referer)
uri.path.starts_with?(::Gitlab::Routing.url_helpers.project_root_sse_path(project))
rescue URI::InvalidURIError
false
end
end
end
end