Browse Source

更改:url转义函数

pull/347/head
yystopf 2 years ago
parent
commit
9e4e30a495
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      app/controllers/attachments_controller.rb

+ 2
- 1
app/controllers/attachments_controller.rb View File

@@ -39,7 +39,8 @@ class AttachmentsController < ApplicationController
filepath, ref = url.split("/")[-1].split("?")
url.gsub!(url.split("/")[-1], '')
Rails.logger.info("url===#{url}")
request_url = [domain, api_url, URI.encode(url), CGI.escape(filepath), "?ref=#{CGI.escape(ref.split('ref=')[1])}&access_token=#{User.where(admin: true).take&.gitea_token}"].join
Rails.logger.info(filepath)
request_url = [domain, api_url, URI.encode(url), URI.escape(filepath), "?ref=#{URI.escape(ref.split('ref=')[1])}&access_token=#{User.where(admin: true).take&.gitea_token}"].join
Rails.logger.info("request_url===#{request_url}")
response = Faraday.get(request_url)
filename = filepath


Loading…
Cancel
Save