Allow to use + symbol in filenames

This commit is contained in:
blackst0ne 2017-01-15 19:48:35 +11:00
parent ee39cbfc0e
commit ad977e8bb2
3 changed files with 20 additions and 2 deletions

View file

@ -0,0 +1,4 @@
---
title: Allow to use + symbol in filenames
merge_request: 6644
author: blackst0ne

View file

@ -61,11 +61,11 @@ module Gitlab
end
def file_name_regex
@file_name_regex ||= /\A[[[:alnum:]]_\-\.\@]*\z/.freeze
@file_name_regex ||= /\A[[[:alnum:]]_\-\.\@\+]*\z/.freeze
end
def file_name_regex_message
"can contain only letters, digits, '_', '-', '@' and '.'."
"can contain only letters, digits, '_', '-', '@', '+' and '.'."
end
def file_path_regex

View file

@ -17,4 +17,18 @@ feature 'Create Snippet', feature: true do
expect(page).to have_content('My Snippet Title')
expect(page).to have_content('Hello World!')
end
scenario 'Authenticated user creates a snippet with + in filename' do
fill_in 'personal_snippet_title', with: 'My Snippet Title'
page.within('.file-editor') do
find(:xpath, "//input[@id='personal_snippet_file_name']").set 'snippet+file+name'
find(:xpath, "//input[@id='personal_snippet_content']").set 'Hello World!'
end
click_button 'Create snippet'
expect(page).to have_content('My Snippet Title')
expect(page).to have_content('snippet+file+name')
expect(page).to have_content('Hello World!')
end
end