Commit 62f8cc11 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'allow_plus_sign_for_snippets' into 'master'

Allow to use '+' symbol in filenames

Closes #22859

See merge request !6644
parents e3c46a00 ad977e8b
---
title: Allow to use + symbol in filenames
merge_request: 6644
author: blackst0ne
...@@ -61,11 +61,11 @@ module Gitlab ...@@ -61,11 +61,11 @@ module Gitlab
end end
def file_name_regex def file_name_regex
@file_name_regex ||= /\A[[[:alnum:]]_\-\.\@]*\z/.freeze @file_name_regex ||= /\A[[[:alnum:]]_\-\.\@\+]*\z/.freeze
end end
def file_name_regex_message def file_name_regex_message
"can contain only letters, digits, '_', '-', '@' and '.'." "can contain only letters, digits, '_', '-', '@', '+' and '.'."
end end
def file_path_regex def file_path_regex
......
...@@ -17,4 +17,18 @@ feature 'Create Snippet', feature: true do ...@@ -17,4 +17,18 @@ feature 'Create Snippet', feature: true do
expect(page).to have_content('My Snippet Title') expect(page).to have_content('My Snippet Title')
expect(page).to have_content('Hello World!') expect(page).to have_content('Hello World!')
end 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 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