fix: decode error
This commit is contained in:
parent
9685c97177
commit
588850440e
|
@ -74,6 +74,7 @@ class RepositoriesController < ApplicationController
|
||||||
|
|
||||||
def sub_entries
|
def sub_entries
|
||||||
file_path_uri = URI.parse(URI.encode(params[:filepath].to_s.strip))
|
file_path_uri = URI.parse(URI.encode(params[:filepath].to_s.strip))
|
||||||
|
@path = Gitea.gitea_config[:domain]+"/#{@project.owner.login}/#{@project.identifier}/raw/branch/#{@ref}/"
|
||||||
|
|
||||||
if @project.educoder?
|
if @project.educoder?
|
||||||
if params[:type] === 'file'
|
if params[:type] === 'file'
|
||||||
|
|
|
@ -6,7 +6,7 @@ module RepositoriesHelper
|
||||||
|
|
||||||
def render_decode64_content(str)
|
def render_decode64_content(str)
|
||||||
return nil if str.blank?
|
return nil if str.blank?
|
||||||
Base64.decode64(str).force_encoding("UTF-8")
|
Base64.decode64(str).force_encoding("UTF-8").encode("UTF-8", invalid: :replace)
|
||||||
end
|
end
|
||||||
|
|
||||||
def download_type(str)
|
def download_type(str)
|
||||||
|
|
|
@ -9,7 +9,7 @@ if @project.forge?
|
||||||
json.type entry['type']
|
json.type entry['type']
|
||||||
json.size entry['size']
|
json.size entry['size']
|
||||||
|
|
||||||
json.content decode64_content(entry, @owner, @repository, @ref)
|
json.content decode64_content(entry, @owner, @repository, @ref, @path)
|
||||||
json.target entry['target']
|
json.target entry['target']
|
||||||
|
|
||||||
download_url =
|
download_url =
|
||||||
|
|
Loading…
Reference in New Issue