Commit b1784438 authored by Robert Schilling's avatar Robert Schilling Committed by Kamil Trzciński

Add support for FTP assets for releases

Extend the list of supported protocols to include FTP.
parent 2b68d0cd
...@@ -6,7 +6,7 @@ module Releases ...@@ -6,7 +6,7 @@ module Releases
belongs_to :release belongs_to :release
validates :url, presence: true, url: true, uniqueness: { scope: :release } validates :url, presence: true, url: { protocols: %w(http https ftp) }, uniqueness: { scope: :release }
validates :name, presence: true, uniqueness: { scope: :release } validates :name, presence: true, uniqueness: { scope: :release }
scope :sorted, -> { order(created_at: :desc) } scope :sorted, -> { order(created_at: :desc) }
......
---
title: Add support for FTP assets for releases
merge_request: 25071
author: Robert Schilling
type: added
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/issues/41766) in GitLab 11.7. > [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/issues/41766) in GitLab 11.7.
Using this API you can manipulate GitLab's [Release](../../user/project/releases/index.md) links. For manipulating other Release assets, see [Release API](index.md). Using this API you can manipulate GitLab's [Release](../../user/project/releases/index.md) links. For manipulating other Release assets, see [Release API](index.md).
GitLab supports links links to `http`, `https`, and `ftp` assets.
## Get links ## Get links
......
...@@ -77,4 +77,28 @@ describe Releases::Link do ...@@ -77,4 +77,28 @@ describe Releases::Link do
it { is_expected.to be_truthy } it { is_expected.to be_truthy }
end end
describe 'supported protocols' do
where(:protocol) do
%w(http https ftp)
end
with_them do
let(:link) { build(:release_link, url: protocol + '://assets.com/download') }
it 'will be valid' do
expect(link).to be_valid
end
end
end
describe 'unsupported protocol' do
context 'for torrent' do
let(:link) { build(:release_link, url: 'torrent://assets.com/download') }
it 'will be invalid' do
expect(link).to be_invalid
end
end
end
end end
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