アップルのユニバーサルリンク用に特定のコンテンツタイプ(application/pkcs7-mime
)のファイルを送信する必要があります。 私はレールからsend_file
関数を使用し、:type
をパラメータとして追加します。 ですが、タイプは常にtext/plain
です。ここでsend_fileでコンテンツタイプを設定する
は私のコントローラです:
class AppleController < ApplicationController
def download_app_site_association
send_file "#{Rails.root}/public/apple-app-site-association", {:filename => "apple-app-site-association", :type => "application/pkcs7-mime" , :x_sendfile => true}
end
end
私もこのようにそれを追加しようとしました:
send_file "#{Rails.root}/public/apple-app-site-association", :filename => "apple-app-site-association", :type => "application/pkcs7-mime" , :x_sendfile => true
と、このようにそれを手動で設定する:誰も私を説明することができ
response.headers["Content-type"] = "application/pkcs7-mime"
send_file "#{Rails.root}/public/apple-app-site-association", :filename => "apple-app-site-association", :x_sendfile => true
なぜこれはうまくいかないのですか?
はい、ありますが、私の質問に書かれているように、それは私のためには機能しません。 – Shrolox
いいえ、それは登録されていませんが、私は自分のコードで問題を発見し、答えを投稿します。とにかく助けてくださって – Shrolox