summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-10-15 01:36:05 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-10-15 01:36:05 +0300
commitd60d5fe4e422ecd83437653bc5764c6269162125 (patch)
treef68792b66efbe866c8e34e6aaad706cdde300777
parent5e9a394440f806302a34bb092e3b46d19430dccc (diff)
downloadgitlab-ce-dz-fix-extract-path.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>
-rw-r--r--lib/extracts_path.rb17
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