Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content disposition header #29

Open
jbmyid opened this issue Mar 22, 2022 · 1 comment
Open

Content disposition header #29

jbmyid opened this issue Mar 22, 2022 · 1 comment

Comments

@jbmyid
Copy link

jbmyid commented Mar 22, 2022

how do we set the content disposition header?

@jbmyid
Copy link
Author

jbmyid commented Mar 22, 2022

def self.azure_url_with_content_disposition(file, options)
    uri = URI file.azure_uri(options[:size] || file.default_style)
    generator = ::Azure::Storage::Core::Auth::SharedAccessSignature.new config( :storage_account_name),config(:storage_access_key)
    _uri = generator.signed_uri uri, false, service:      'b',
                                      resource:     'b',
                                      permissions:  'r',
                                      start:        (Time.now - (5 * 60)).utc.iso8601,
                                      expiry:       (Time.now + config(:expiring_time)).utc.iso8601,
                                      content_disposition: "attachment;filename=#{options[:file_name]}"
    _uri.to_s
  end

Made content disposition working with customized URL code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant