diff options
| author | Johannes Schleifenbaum <johannes@js-webcoding.de> | 2013-10-30 11:20:43 +0100 |
|---|---|---|
| committer | Johannes Schleifenbaum <johannes@js-webcoding.de> | 2013-10-30 11:34:26 +0100 |
| commit | cc505f550da83b2073adb168bcca620f656a076b (patch) | |
| tree | 21dda30dfb8b36baf57b529361210c05eada66a0 /app/controllers | |
| parent | ee0e9830c1c1e4c54fd0b18fadef50f76c3680a4 (diff) | |
| download | gitlab-ce-cc505f550da83b2073adb168bcca620f656a076b.tar.gz | |
Check if a file is editied "on" a branch or a commit.
The previous behavior was a "disabled" link, which was still clickable
and linked to the edit file action.
If the user accesses a path like "/edit/master/README" show the file
edit form (just like before).
If the user accesses a path like
"/edit/8d5c1f375ce99e5df84e26b0eafbf1448c6a001e/README", redirect the
user to the file detail page with a note, that he cannot edit a file
"on" a commit.
fixes #5482
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/projects/edit_tree_controller.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/controllers/projects/edit_tree_controller.rb b/app/controllers/projects/edit_tree_controller.rb index 5d05c585ecc..0e51ff59f39 100644 --- a/app/controllers/projects/edit_tree_controller.rb +++ b/app/controllers/projects/edit_tree_controller.rb @@ -45,5 +45,9 @@ class Projects::EditTreeController < Projects::ApplicationController end return access_denied! unless allowed + + unless @repository.branch_names.include?(@ref) + redirect_to project_blob_path(@project, @id), notice: "You can only edit this file if you are on top of a branch" + end end end |
