summaryrefslogtreecommitdiff
path: root/app/contexts
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-11-20 10:03:50 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-11-20 10:03:50 +0200
commit3bab1bd4c162239dcf582a82360cf94d4953ef69 (patch)
tree8fa6edb9dd9ebc7dbf40dfe59abf9b0fb4251831 /app/contexts
parent33eae33423d224e10a3a9aeefd70d632d70b20fe (diff)
downloadgitlab-ce-3bab1bd4c162239dcf582a82360cf94d4953ef69.tar.gz
Improve consistency: use file_path for API create/update/delete files
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/contexts')
-rw-r--r--app/contexts/files/create_context.rb9
1 files changed, 2 insertions, 7 deletions
diff --git a/app/contexts/files/create_context.rb b/app/contexts/files/create_context.rb
index ae73b11bd54..10273138559 100644
--- a/app/contexts/files/create_context.rb
+++ b/app/contexts/files/create_context.rb
@@ -15,18 +15,13 @@ module Files
return error("You can only create files if you are on top of a branch")
end
- file_name = params[:file_name]
+ file_name = File.basename(path)
+ file_path = path
unless file_name =~ Gitlab::Regex.path_regex
return error("Your changes could not be commited, because file name contains not allowed characters")
end
- file_path = if path.blank?
- file_name
- else
- File.join(path, file_name)
- end
-
blob = repository.blob_at(ref, file_path)
if blob