Skip to content

Commit

Permalink
custom file name
Browse files Browse the repository at this point in the history
  • Loading branch information
jicheng1014 committed Jun 12, 2024
1 parent 36fc3f0 commit 1fa0936
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/fir/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,10 @@ def info(*args)
method_option :auto_download_bundletool_jar, type: :boolean, default: false, desc: "upload aab file command: would download bundletool when invoke bundletool failure"

method_option :save_uploaded_info, type: :boolean, default: false, desc: 'save uploaded info to local file named fir-cli-answer.json'

method_option :user_download_file_name, type: :string, desc: 'set user download file name, (not support with params switch_to_qiniu)'
def publish(*args)
prepare :publish

FIR.publish(*args, options)
end

Expand Down
10 changes: 10 additions & 0 deletions lib/fir/util/ali_uploader.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

require 'uri'
require_relative './app_uploader'


Expand Down Expand Up @@ -39,6 +40,15 @@ def upload_binary
'authorization' => headers[:authorization]
}

if @options[:user_download_file_name] != nil
# 处理中文问题, 使之支持 CONTENT-DISPOSITION 的要求


headers_copy["CONTENT-DISPOSITION"] = "attachment; filename=#{URI.encode_www_form_component @options[:user_download_file_name]}"


end

logger.debug headers_copy
put_file(binary_url, binary_info, headers_copy)
callback_to_api(callback_url, callback_binary_information)
Expand Down
2 changes: 1 addition & 1 deletion lib/fir/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# encoding: utf-8

module FIR
VERSION = "2.0.21"
VERSION = "2.0.22"
end

0 comments on commit 1fa0936

Please sign in to comment.