Browse Source

FIX base and head params problem for compare api

tags/v3.0.0
Jasder 5 years ago
parent
commit
4c2c3d17e2
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      app/controllers/compare_controller.rb

+ 3
- 3
app/controllers/compare_controller.rb View File

@@ -6,9 +6,9 @@ class CompareController < ApplicationController
end

def show
base_ref = Addressable::URI.unescape(params[:base])
@ref = head_ref = Addressable::URI.unescape(params[:head]&.split('.json')[0])
@compare_result = Gitea::Repository::Commits::CompareService.call(@owner.login, @project.identifier, base_ref, head_ref)
base = Addressable::URI.unescape(params[:base])
head = params[:head].include?('json') ? params[:head]&.split('.json')[0] : params[:head]
@compare_result = Gitea::Repository::Commits::CompareService.call(@owner.login, @project.identifier, head, base)

# render json: @compare_result
end


Loading…
Cancel
Save