fix: readme return decode data

This commit is contained in:
yystopf 2021-09-30 14:59:37 +08:00
parent 59fe010fdb
commit f7ba082944
1 changed files with 3 additions and 1 deletions

View File

@ -1,4 +1,5 @@
class RepositoriesController < ApplicationController
include RepositoriesHelper
include ApplicationHelper
include OperateProjectAbilityAble
include Repository::LanguagesPercentagable
@ -198,7 +199,8 @@ class RepositoriesController < ApplicationController
result = Gitea::Repository::Readme::GetService.call(@owner.login, @repository.identifier, params[:ref], current_user&.gitea_token)
end
@readme = result[:status] === :success ? result[:body] : nil
@readme['content'] = decode64_content(@readme, @owner, @repository, params[:ref])
Rails.logger.info "======+#{@readme}"
render json: @readme.slice("type", "encoding", "size", "name", "path", "content", "sha")
rescue
render json: nil