Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
ad977e8b
Commit
ad977e8b
authored
Jan 15, 2017
by
blackst0ne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to use + symbol in filenames
parent
ee39cbfc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
2 deletions
+20
-2
changelogs/unreleased/allow_plus_sign_for_snippets.yml
changelogs/unreleased/allow_plus_sign_for_snippets.yml
+4
-0
lib/gitlab/regex.rb
lib/gitlab/regex.rb
+2
-2
spec/features/snippets/create_snippet_spec.rb
spec/features/snippets/create_snippet_spec.rb
+14
-0
No files found.
changelogs/unreleased/allow_plus_sign_for_snippets.yml
0 → 100644
View file @
ad977e8b
---
title
:
Allow to use + symbol in filenames
merge_request
:
6644
author
:
blackst0ne
lib/gitlab/regex.rb
View file @
ad977e8b
...
@@ -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
...
...
spec/features/snippets/create_snippet_spec.rb
View file @
ad977e8b
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment