|
|
|
@@ -161,6 +161,7 @@ module RepositoriesHelper |
|
|
|
s_content = s_content.starts_with?("/") ? s_content[1..-1] : s_content[0..-1] |
|
|
|
s_content = File.expand_path(s_content, file_path) |
|
|
|
s_content = s_content.split("#{Rails.root}/")[1] |
|
|
|
next if s_content.blank? |
|
|
|
# content = content.gsub(s[0], "/#{s_content}") |
|
|
|
join_xxx = s_content.include?("?") ? "&" : "?" |
|
|
|
s_content = [base_url, "/api/#{owner&.login}/#{repo.identifier}/raw/#{s_content}#{join_xxx}ref=#{ref}"].join |
|
|
|
@@ -190,6 +191,7 @@ module RepositoriesHelper |
|
|
|
path = [owner&.login, repo&.identifier, 'tree', ref, file_path].join("/") |
|
|
|
s_content = File.expand_path(s_content, path) |
|
|
|
s_content = s_content.split("#{Rails.root}")[1] |
|
|
|
next if s_content.blank? |
|
|
|
case k.to_s |
|
|
|
when 'ss_src' |
|
|
|
content = content.gsub("src=\"#{s[0]}\"", "src=\"/#{s_content}\"") |
|
|
|
@@ -202,7 +204,7 @@ module RepositoriesHelper |
|
|
|
when 'ss_href_1' |
|
|
|
content = content.gsub("href=\'#{s[0]}\'", "href=\'#{s_content}\'") |
|
|
|
else |
|
|
|
content = content.gsub("(#{s[0]})", "(/#{s_content})") |
|
|
|
content = content.gsub("(#{s[0]})", "(#{s_content})") |
|
|
|
end |
|
|
|
end |
|
|
|
rescue |
|
|
|
|