diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-10-15 01:36:05 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-10-15 01:36:05 +0300 |
commit | d60d5fe4e422ecd83437653bc5764c6269162125 (patch) | |
tree | f68792b66efbe866c8e34e6aaad706cdde300777 /lib/extracts_path.rb | |
parent | 5e9a394440f806302a34bb092e3b46d19430dccc (diff) | |
download | gitlab-ce-d60d5fe4e422ecd83437653bc5764c6269162125.tar.gz |
Improve ExtractsPath logic related to atom formatdz-fix-extract-path
* Don't set request format to atom if '.atom' suffix was not provided
* Don't try '.atom' detection logic on request that uses extended_sha1
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'lib/extracts_path.rb')
-rw-r--r-- | lib/extracts_path.rb | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/extracts_path.rb b/lib/extracts_path.rb index e4d996a3fb6..9b74364849e 100644 --- a/lib/extracts_path.rb +++ b/lib/extracts_path.rb @@ -113,17 +113,18 @@ module ExtractsPath @id = get_id @ref, @path = extract_ref(@id) @repo = @project.repository - if @options[:extended_sha1].blank? - @commit = @repo.commit(@ref) - else - @commit = @repo.commit(@options[:extended_sha1]) - end - if @path.empty? && !@commit - @id = @ref = extract_ref_without_atom(@id) + if @options[:extended_sha1].present? + @commit = @repo.commit(@options[:extended_sha1]) + else @commit = @repo.commit(@ref) - request.format = :atom if @commit + if @path.empty? && !@commit && @id.ends_with?('.atom') + @id = @ref = extract_ref_without_atom(@id) + @commit = @repo.commit(@ref) + + request.format = :atom if @commit + end end raise InvalidPathError unless @commit |