|
|
|
@@ -32,7 +32,7 @@ class AttachmentsController < ApplicationController |
|
|
|
def get_file |
|
|
|
normal_status(-1, "参数缺失") if params[:download_url].blank? |
|
|
|
url = base_url.starts_with?("https:") ? URI.encode(params[:download_url].to_s.gsub("http:", "https:")) : URI.encode(params[:download_url].to_s) |
|
|
|
if url.starts_with?(base_url) |
|
|
|
if url.starts_with?(base_url) && !url.starts_with?("#{base_url}/repo") |
|
|
|
domain = GiteaService.gitea_config[:domain] |
|
|
|
api_url = GiteaService.gitea_config[:base_url] |
|
|
|
url = ("/repos"+url.split(base_url + "/api")[1]).gsub('?filepath=', '/').gsub('&', '?') |
|
|
|
|