mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-02 19:30:48 +08:00
readme GBK编码问题
This commit is contained in:
@@ -208,8 +208,8 @@ module RepositoriesHelper
|
|||||||
if is_readme?(entry['type'], entry['name'])
|
if is_readme?(entry['type'], entry['name'])
|
||||||
Rails.logger.info("entry===#{entry["type"]} #{entry["name"]}")
|
Rails.logger.info("entry===#{entry["type"]} #{entry["name"]}")
|
||||||
content = entry['content'].present? ? entry['content'] : Gitea::Repository::Entries::GetService.call(owner, repo.identifier, URI.escape(entry['path']), ref: ref)['content']
|
content = entry['content'].present? ? entry['content'] : Gitea::Repository::Entries::GetService.call(owner, repo.identifier, URI.escape(entry['path']), ref: ref)['content']
|
||||||
Rails.logger.info("Base64.decode64(content).encoding===#{Base64.decode64(content).encoding}")
|
# Rails.logger.info("Base64.decode64(content).encoding===#{Base64.decode64(content).encoding}")
|
||||||
return Base64.decode64(content).force_encoding("GBK").encode("UTF-8") if Base64.decode64(content).encoding == Encoding::ASCII_8BIT
|
# return Base64.decode64(content).force_encoding("GBK").encode("UTF-8") if Base64.decode64(content).encoding == Encoding::ASCII_8BIT
|
||||||
return Base64.decode64(content).force_encoding('UTF-8')
|
return Base64.decode64(content).force_encoding('UTF-8')
|
||||||
else
|
else
|
||||||
file_type = File.extname(entry['name'].to_s)[1..-1]
|
file_type = File.extname(entry['name'].to_s)[1..-1]
|
||||||
|
|||||||
Reference in New Issue
Block a user