From 938f3b2a0b4bdf2047caf8735312c80e2291b274 Mon Sep 17 00:00:00 2001 From: Paco Guzman Date: Wed, 17 Aug 2016 17:05:00 +0200 Subject: edit_blob_link can receive the blob to avoid access to the repository --- app/helpers/blob_helper.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'app/helpers') diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index 1cb5d847626..9ea03720c1e 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -11,17 +11,14 @@ module BlobHelper def edit_blob_link(project = @project, ref = @ref, path = @path, options = {}) return unless current_user - blob = project.repository.blob_at(ref, path) rescue nil + blob = options.delete(:blob) + blob ||= project.repository.blob_at(ref, path) rescue nil return unless blob - from_mr = options[:from_merge_request_id] - link_opts = {} - link_opts[:from_merge_request_id] = from_mr if from_mr - edit_path = namespace_project_edit_blob_path(project.namespace, project, tree_join(ref, path), - link_opts) + options[:link_opts]) if !on_top_of_branch?(project, ref) button_tag "Edit", class: "btn disabled has-tooltip btn-file-option", title: "You can only edit files when you are on a branch", data: { container: 'body' } -- cgit v1.2.1