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
Boxiang Sun
gitlab-ce
Commits
d1e0b1b3
Commit
d1e0b1b3
authored
7 years ago
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow creation of files and directories with spaces in web UI
parent
81dba76b
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
2 deletions
+35
-2
changelogs/unreleased/23162-allow-creation-of-files-and-dirs-with-spaces-in-web-ui.yml
...llow-creation-of-files-and-dirs-with-spaces-in-web-ui.yml
+4
-0
features/steps/project/source/browse_files.rb
features/steps/project/source/browse_files.rb
+1
-1
lib/gitlab/regex.rb
lib/gitlab/regex.rb
+1
-1
spec/lib/gitlab/git/index_spec.rb
spec/lib/gitlab/git/index_spec.rb
+19
-0
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+10
-0
No files found.
changelogs/unreleased/23162-allow-creation-of-files-and-dirs-with-spaces-in-web-ui.yml
0 → 100644
View file @
d1e0b1b3
---
title
:
Allow creation of files and directories with spaces through Web UI
merge_request
:
12608
author
:
This diff is collapsed.
Click to expand it.
features/steps/project/source/browse_files.rb
View file @
d1e0b1b3
...
@@ -93,7 +93,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
...
@@ -93,7 +93,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
end
end
step
'I fill the new file name with an illegal name'
do
step
'I fill the new file name with an illegal name'
do
fill_in
:file_name
,
with:
'
Spaces Not Allowed
'
fill_in
:file_name
,
with:
'
Filename/Slash
'
end
end
step
'I fill the new file name with a new directory'
do
step
'I fill the new file name with a new directory'
do
...
...
This diff is collapsed.
Click to expand it.
lib/gitlab/regex.rb
View file @
d1e0b1b3
...
@@ -20,7 +20,7 @@ module Gitlab
...
@@ -20,7 +20,7 @@ module Gitlab
end
end
def
file_name_regex
def
file_name_regex
@file_name_regex
||=
/\A[
[[:alnum:]]_\-\.\@\+
]*\z/
.
freeze
@file_name_regex
||=
/\A[
^\/\0
]*\z/
.
freeze
end
end
def
file_name_regex_message
def
file_name_regex_message
...
...
This diff is collapsed.
Click to expand it.
spec/lib/gitlab/git/index_spec.rb
View file @
d1e0b1b3
...
@@ -25,6 +25,16 @@ describe Gitlab::Git::Index, seed_helper: true do
...
@@ -25,6 +25,16 @@ describe Gitlab::Git::Index, seed_helper: true do
expect
(
entry
).
not_to
be_nil
expect
(
entry
).
not_to
be_nil
expect
(
repository
.
lookup
(
entry
[
:oid
]).
content
).
to
eq
(
options
[
:content
])
expect
(
repository
.
lookup
(
entry
[
:oid
]).
content
).
to
eq
(
options
[
:content
])
end
end
it
'creates the file if file_path has spaces in between words'
do
options
[
:file_path
]
=
'new file.txt'
index
.
create
(
options
)
entry
=
index
.
get
(
options
[
:file_path
])
expect
(
entry
).
not_to
be_nil
expect
(
repository
.
lookup
(
entry
[
:oid
]).
content
).
to
eq
(
options
[
:content
])
end
end
end
context
'when a file at that path exists'
do
context
'when a file at that path exists'
do
...
@@ -81,6 +91,15 @@ describe Gitlab::Git::Index, seed_helper: true do
...
@@ -81,6 +91,15 @@ describe Gitlab::Git::Index, seed_helper: true do
expect
(
entry
).
not_to
be_nil
expect
(
entry
).
not_to
be_nil
end
end
it
'creates the dir if it has spaces in between words'
do
options
[
:file_path
]
=
'new dir'
index
.
create_dir
(
options
)
entry
=
index
.
get
(
options
[
:file_path
]
+
'/.gitkeep'
)
expect
(
entry
).
not_to
be_nil
end
end
end
context
'when a file at that path exists'
do
context
'when a file at that path exists'
do
...
...
This diff is collapsed.
Click to expand it.
spec/models/repository_spec.rb
View file @
d1e0b1b3
...
@@ -347,6 +347,16 @@ describe Repository, models: true do
...
@@ -347,6 +347,16 @@ describe Repository, models: true do
expect
(
blob
.
data
).
to
eq
(
'Changelog!'
)
expect
(
blob
.
data
).
to
eq
(
'Changelog!'
)
end
end
it
'creates new file with spaces in between successfully'
do
expect
do
repository
.
create_file
(
user
,
'NEW FILE'
,
'File!'
,
message:
'Create NEW FILE'
,
branch_name:
'master'
)
end
.
to
change
{
repository
.
commits
(
'master'
).
count
}.
by
(
1
)
expect
(
repository
.
blob_at
(
'master'
,
'NEW FILE'
).
data
).
to
eq
(
'File!'
)
end
it
'respects the autocrlf setting'
do
it
'respects the autocrlf setting'
do
repository
.
create_file
(
user
,
'hello.txt'
,
"Hello,
\r\n
World"
,
repository
.
create_file
(
user
,
'hello.txt'
,
"Hello,
\r\n
World"
,
message:
'Add hello world'
,
message:
'Add hello world'
,
...
...
This diff is collapsed.
Click to expand it.
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