Commit a772e010 authored by Kamil Trzciński's avatar Kamil Trzciński
Browse files

Merge branch '57410-api-create-release-link-with-ftp-address-return-400-bad-request' into 'master'

Add support for FTP assets for releases

Closes #57410

See merge request gitlab-org/gitlab-ce!25071
parents 2b68d0cd b1784438
......@@ -6,7 +6,7 @@ class Link < ActiveRecord::Base
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 }
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 @@
> [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).
GitLab supports links links to `http`, `https`, and `ftp` assets.
## Get links
......
......@@ -77,4 +77,28 @@
it { is_expected.to be_truthy }
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
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