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

s3_headers proc/lambda doesn't work #36

Open
zainzafar opened this issue Aug 15, 2020 · 2 comments
Open

s3_headers proc/lambda doesn't work #36

zainzafar opened this issue Aug 15, 2020 · 2 comments

Comments

@zainzafar
Copy link

Describe the bug

To Reproduce
Steps to reproduce the behavior:

has_attached_file :asset,
  s3_headers: lambda { |attachment|
    puts "*********** attachment = #{attachment.to_json}"
    {
      'Cache-Control' => "max-age=#{1.year.to_i}",
      'Expires' => 1.year.from_now.httpdate,
      'Content-Disposition': "Attachment; file=#{attachment.asset_file_name}"
    }
  }

Expected behavior
When uploading a PDF file named "Test.pdf", it should print out

*********** attachment = {...., asset_file_name: "Test.pdf", asset_content_type: "application/pdf".... }

Desktop (please complete the following information):

  • OS: Docker ruby 2.6.6

Additional context
s3_headers doesn't get called with attachment therefore attachment.asset_file_name returns nil

@ssinghi
Copy link

ssinghi commented Oct 11, 2020

Hi @zainzafar Thanks for the bug report.
If you can please submit a PR to fix this with a failing test case, that will be really great

@sasharevzin
Copy link

Just to save some time searching, here is the commit when proc support was added

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

3 participants