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

Direct Uploads with Azure : PDF and Video preview doesn't work #32530

Closed
amulgarg opened this issue Apr 11, 2018 · 0 comments
Closed

Direct Uploads with Azure : PDF and Video preview doesn't work #32530

amulgarg opened this issue Apr 11, 2018 · 0 comments

Comments

@amulgarg
Copy link

Steps to reproduce

  1. Set :azure as the active_storage service
  2. Attach a PDF file to your model (Post in my case, upload is the attachment)
  3. Try to use Post.first.upload.preview(resize: "100x100") in a rails view

Expected behavior

Should display a preview image for the PDF file

Actual behavior

Fails with an error:

NoMethodError (undefined method 'bytesize' for #<Tempfile: (closed)>):
  
/usr/share/rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/delegate.rb:87:in 'method_missing'
vendor/bundle/ruby/2.4.0/gems/azure-core-0.1.14/lib/azure/core/http/http_request.rb:197:in 'apply_miscellaneous_headers'
vendor/bundle/ruby/2.4.0/gems/azure-core-0.1.14/lib/azure/core/http/http_request.rb:164:in 'apply_body_headers'
vendor/bundle/ruby/2.4.0/gems/azure-core-0.1.14/lib/azure/core/http/http_request.rb:141:in 'body='
vendor/bundle/ruby/2.4.0/gems/azure-core-0.1.14/lib/azure/core/http/http_request.rb:74:in 'initialize'
vendor/bundle/ruby/2.4.0/gems/azure-core-0.1.14/lib/azure/core/service.rb:34:in 'new'
vendor/bundle/ruby/2.4.0/gems/azure-core-0.1.14/lib/azure/core/service.rb:34:in 'call'
vendor/bundle/ruby/2.4.0/gems/azure-core-0.1.14/lib/azure/core/filtered_service.rb:34:in 'call'
vendor/bundle/ruby/2.4.0/gems/azure-core-0.1.14/lib/azure/core/signed_service.rb:41:in 'call'
vendor/bundle/ruby/2.4.0/gems/azure-storage-0.15.0.preview/lib/azure/storage/service/storage_service.rb:62:in 'call'
vendor/bundle/ruby/2.4.0/gems/azure-storage-0.15.0.preview/lib/azure/storage/blob/blob_service.rb:62:in 'call'
vendor/bundle/ruby/2.4.0/gems/azure-storage-0.15.0.preview/lib/azure/storage/blob/block.rb:118:in 'create_block_blob'
vendor/bundle/ruby/2.4.0/gems/activestorage-5.2.0.rc2/lib/active_storage/service/azure_storage_service.rb:23:in 'block in upload'
vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.0.rc2/lib/active_support/notifications.rb:168:in 'block in instrument'
vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.0.rc2/lib/active_support/notifications/instrumenter.rb:23:in 'instrument'
vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.0.rc2/lib/active_support/notifications.rb:168:in 'instrument'
vendor/bundle/ruby/2.4.0/gems/activestorage-5.2.0.rc2/lib/active_storage/service.rb:118:in 'instrument'
vendor/bundle/ruby/2.4.0/gems/activestorage-5.2.0.rc2/lib/active_storage/service/azure_storage_service.rb:21:in 'upload'
vendor/bundle/ruby/2.4.0/gems/activestorage-5.2.0.rc2/app/models/active_storage/blob.rb:155:in 'upload'
vendor/bundle/ruby/2.4.0/gems/activestorage-5.2.0.rc2/app/models/active_storage/blob.rb:53:in 'block in build_after_upload'
vendor/bundle/ruby/2.4.0/gems/activestorage-5.2.0.rc2/app/models/active_storage/blob.rb:48:in 'tap'
vendor/bundle/ruby/2.4.0/gems/activestorage-5.2.0.rc2/app/models/active_storage/blob.rb:48:in 'build_after_upload'
vendor/bundle/ruby/2.4.0/gems/activestorage-5.2.0.rc2/app/models/active_storage/blob.rb:61:in 'create_after_upload!'
vendor/bundle/ruby/2.4.0/gems/activestorage-5.2.0.rc2/lib/active_storage/attached.rb:28:in 'create_blob_from'
vendor/bundle/ruby/2.4.0/gems/activestorage-5.2.0.rc2/lib/active_storage/attached/one.rb:24:in 'attach'
vendor/bundle/ruby/2.4.0/gems/activestorage-5.2.0.rc2/app/models/active_storage/preview.rb:74:in 'block in process'
vendor/bundle/ruby/2.4.0/gems/activestorage-5.2.0.rc2/lib/active_storage/previewer/poppler_pdf_previewer.rb:24:in 'block (2 levels) in preview'
vendor/bundle/ruby/2.4.0/gems/activestorage-5.2.0.rc2/lib/active_storage/previewer.rb:49:in 'block (2 levels) in draw'
vendor/bundle/ruby/2.4.0/gems/activestorage-5.2.0.rc2/lib/active_storage/previewer.rb:58:in 'open_tempfile_for_drawing'
vendor/bundle/ruby/2.4.0/gems/activestorage-5.2.0.rc2/lib/active_storage/previewer.rb:47:in 'block in draw'
vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.0.rc2/lib/active_support/notifications.rb:170:in 'instrument'
vendor/bundle/ruby/2.4.0/gems/activestorage-5.2.0.rc2/lib/active_storage/previewer.rb:46:in 'draw'

System configuration

Rails version: 5.2.0.rc2

Ruby version: 2.4.2p198

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

No branches or pull requests

3 participants