diff options
Diffstat (limited to 'lib/extracts_path.rb')
-rw-r--r-- | lib/extracts_path.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/extracts_path.rb b/lib/extracts_path.rb index e02d403f7b1..a340a276640 100644 --- a/lib/extracts_path.rb +++ b/lib/extracts_path.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Module providing methods for dealing with separating a tree-ish string and a # file path string when combined in a request parameter module ExtractsPath @@ -50,7 +52,9 @@ module ExtractsPath # branches and tags # Append a trailing slash if we only get a ref and no file path - id += '/' unless id.ends_with?('/') + unless id.ends_with?('/') + id = [id, '/'].join + end valid_refs = ref_names.select { |v| id.start_with?("#{v}/") } @@ -151,9 +155,9 @@ module ExtractsPath # overriden in subclasses, do not remove def get_id - id = params[:id] || params[:ref] - id += "/" + params[:path] unless params[:path].blank? - id + id = [params[:id] || params[:ref]] + id << "/" + params[:path] unless params[:path].blank? + id.join end def ref_names |