Giter Site home page Giter Site logo

filestack / filestack-ruby Goto Github PK

View Code? Open in Web Editor NEW
34.0 34.0 27.0 5.49 MB

Official Ruby SDK for Filestack - API and content management system that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.

Home Page: https://www.filestack.com

License: Apache License 2.0

Ruby 99.81% Shell 0.19%
hacktoberfest ruby sdk-ruby transforming-files upload-file upload-images

filestack-ruby's People

Contributors

14113 avatar bantic avatar bkwi avatar fdeschenes avatar gabifija avatar hueyl77 avatar omertestrail avatar oojewale avatar schonert avatar socio-mehmet avatar staturecrane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

filestack-ruby's Issues

bootsnap, rails test

When I run rails rest command I get the following error message.

/home/ubuntu/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:34:in `require': cannot load such file -- rexml/document (LoadError)

this is the gem i have installed.

Ability to pull file metadata by handle id?

When you upload a file you get back essentially something like this:

#<FilestackFilelink:0x007faf141202a8 @handle="12345", @apikey="XXXXX", @security=nil>

Is there the ability to then get that file metadata?

Essentially need to get back something like this:

{"filename":"blah.doc","handle":"12345","mimetype":"application/msword","originalPath":"somefile.doc","size":62976,"source":"local_file_system","url":"https://cdn.filestackcontent.com/12345,"status":"Stored"}

How to save metadata to @user.filestack_url

I'm currently doing
<%= f.filestack_field :filepicker_url, 'Upload Your Avatar!', id: 'unique-id' %> to upload files and it's working fine. but I also want to save the metadata (such as name, filetype, ect.) to my rails application. Otherwise, i can't grab the name of the files for my users to see.

Get GitHub actions running tests against Ruby 3.x

Right now there's a Travis CI file that doesn't appear to be active, and only mentions Ruby 2.x.

These days, most projects have moved to running GitHub actions for testing & linting.

If this project is indeed active (i.e. seeing recent activity from @sethk4783), It would be great to get that running for this project so it is clear that this project is compatible with Ruby 3.x.

Reading data from IO object

As far as I know this gem does not support reading data from IO object. It only accepts file path. Most of the time we produce the content on the memory so we do not have physical file. Filestack gem forces us to save this data on the disk then giving the file path. This hurts the performance due to many system calls. It would be very nice if it supports to accept an IO object like the following.

  file = StringIO.new
  client = FilestackClient.new(ENV['KEY'])
  file_link = client.upload(io: file)

Gemspec is out of date and too restrictive

I'm trying to do a maintenance job on a project that uses filestack-ruby. To be able to use latest 5.x Rails, I need to upgrade some of the gems. One of them requires parallel with minimum version of 0.12, which is not compatible with filestack-ruby's requirements.

Missing 'cache' Transformation

I notice that cache is not a valid item under TRANSFORMATIONS. For example, I'd like to be able to do:

transform.cache(expiry: 'max')

Is there any reason why I cannot create a PR to whitelist it?

Typhoeus upgrade compatibility issues

Upgrading to version 2.3, I've been running into a couple of compatability issues that are due to the upgrade:

  1. Calls to the typhoeus library appear to be using the wrong key to pass parameters via url, e.g.
    Typhoeus.public_send(action, url, body: parameters, headers: headers) in UploadUtils#make_call should be using the params parameter instead of body. An example of this showing up is FilestackFilelink#metadata no longer recognizing parameters passed to it.
  2. Typhoeus return values are now JSON strings instead of hashes. While this can be worked around in cases where the direct response is returned, it causes issues when further parsing happens after the response. For example, in Transform#store, the method attempts to pull the handle from the response string, with the result being a FilestackFilelink being declared with the handle 'url' instead of pulling the url out of the response.

unirest uses old version of rest-client

I'm not able to use this gem due to conflicting rest-client gem version with some other gems I have in my project. One of the gems require rest-client >= 2.0 and filestack-ruby requires unirest which requires the older rest-client (~> 1.6.7). I would have opened an issue upon unirest but it seems like it's unmaintained and there are a bunch of other old dependency issues in there: look at Kong/unirest-ruby#45 and
Kong/unirest-ruby#33

Filestack scanning viruses

Sorry to ask this question but does filestack scan viruses for every uploaded file? Is there a doc somewhere?

docs provider error: conversion was taking too long (idx 0)

Hi there, when I try to do a

client.upload(external_url: url)

I sometimes get an error

*** JSON::ParserError Exception: 435: unexpected token at 'uuid=API-XXXXXX] Invalid response when trying to read from http://internal-taskrouters-...

When visiting the API url in my browser the response is

docs provider error: conversion was taking too long (idx 0)

Is there a way to increase the timeout for this? Or when this error happens have the API response with some JSON so that the gem doesn't get upset?

Uploading from local file always returns handle as nil

Uploading a file from a local path is consistently returning a FilestackFileLink with handle nil. I'm on a Rails project using the filestack-rails gem. Uploading from an external URL works fine.

Here is the behavior I'm seeing:

# in rails console
$ security = FilestackSecurity.new('secret', options: {expiry: 1546250400, call: %w[read store pick]})
$ client = FilestackClient.new('apikey', security: security)
$ client.upload(filepath: '/path/to/image/cat.jpg')  
[##########################################################################################] [1/1] [100.00%] [00:11] [00:00] [0.09/s]
=> #<FilestackFilelink:0x00007fb159600ad8
 @apikey="<text>",
 @handle=nil,
 @security=
  #<FilestackSecurity:0x00007fb159102518
   @policy="<text>",
   @signature="<text>">>

I'm not getting any errors, simply a returned FilestackFileLink with a nil handle.

Yanked mimemagic versions and GPL2

Early this morning, mimemagic (a dependency in your project) resolved a licensing issue by updating their license from MIT to GPL 2 and yanking all old versions. The maintainer has made 0.3.6 available which resolves the mimemagic (~> 0.3.2) dependency, but it is now licensed as GPL 2, which (IANAL) makes all derived works (including your library, and users of your library) GPL 2.

See mimemagicrb/mimemagic#97, mimemagicrb/mimemagic#98, and rails/rails#41750.

There is a MIT-compatible fork in the works. My question is, does Filestack plan to update their libraries to not be a derived work of GPL 2?

Related: #76

Storage provider error

Hi,

I have an issue when I am trying to store an image.

filelink = FilestackFilelink.new('YHlpKd4RXS3BNt0y0Gci')
thumbnail = filelink.transform.resize(width: 100).rotate(deg: 'exif')
thumbnail.store
...

The error is:

NoMethodError: undefined method `split' for nil:NilClass

Error occur at the line 83 of filestack-ruby/lib/filestack/models/filestack_transform.rb

This is the response body I have:

#<Unirest::HttpResponse:0x007fde93542d78 @code=403, @headers={:server=>"nginx", :content_type=>"text/plain; charset=utf-8", :access_control_allow_headers=>"Content-Type, X-No-Stream", :access_control_allow_methods=>"GET", :access_control_allow_origin=>"*", :access_control_max_age=>"21600", :cache_control=>"private", :x_content_type_options=>"nosniff", :content_encoding=>"gzip", :via=>"1.1 varnish", :fastly_debug_digest=>"b04ab82bf004f764ddd4b01f5a4befd1107b6a951dc75a44b4c6b811a6456114", :content_length=>"78", :accept_ranges=>"bytes", :date=>"Sat, 26 Aug 2017 19:47:55 GMT", :age=>"0", :connection=>"keep-alive", :x_served_by=>"cache-iad2124-IAD, cache-lhr6331-LHR", :x_cache=>"HIT, MISS", :x_cache_hits=>"1, 0", :x_timer=>"S1503776875.483301,VS0,VE80", :vary=>"Accept-Encoding"}, @raw_body="storage provider error: Invalid Application (idx 0)\n", @body="storage provider error: Invalid Application (idx 0)\n">

It was ok few weeks ago.

Thank you for your help

RuntimeError invalid params: size

Filestack gem version: 2.9.6

Error:
{"error":"invalid params: size","timestamp":1644208088}

Stack trace:
Screen Shot 2022-02-08 at 12 04 43 PM

It happens randomly and not depend on file extension or file size, from my observation. Is it a network error? Also, it seems multipart upload is default and I can't disable it via settings anymore.

Multipart upload leads to Rails PG error

Hi, we're integrating the ruby client 2.0.1, in our Rails 5.1. project. We have our own frontend uploader, and we just need to upload the file. We do a regular upload and then save the FilestackFilelink handle to a local model (Attachment) using the code below:

security = FilestackSecurity.new(app_secret, options: {})
client = FilestackClient.new(apikey, security: security)
filelink_handle = client.upload(filepath: path)
Attachment.create!(handle: filelink_handle.handle)

However, this throws an exception on the ActiveRecord create.

ActiveRecord::StatementInvalid (PG::ConnectionBad: PQconsumeInput() server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.

I've narrowed it down to the multipart operation. Somewhere along the line something is throwing an exception that gets propagated into the Rails internals. A workaround is to force multipart to false:

filelink_handle = client.upload(filepath: path, multipart: false)

Any ideas on what could be causing this exception?

mini_mime version specificity too tight

Is there a reason why mini_mime is specified to the minor version? As specified currently it results in a version conflict preventing us from being able to use the filestack gem with mini_mime v1.1.0

I suggest altering the gemspec from

spec.add_dependency "mini_mime", "~> 1.0.2"
to
spec.add_dependency "mini_mime", "~> 1.0"

Policy generation ignores expiry time when receiving a hash with string keys

Hi, I submitted an issue in the filestack-rails repo (filestack/filestack-rails#175), which after some poking around I have solved and found that it's a small issue with this gem instead. I'll be submitting a pull request shortly, but I'd like to outline my original issue and proposed changes.


Using filestack-rails, I set up a security policy this way:

config.filestack_rails.security = { 'expiry' => 4663446066,  'call' => %w[pick read stat write writeUrl store convert remove exif] }

This hash is handled by the filestack-rails gem and passed directly into a new FilestackSecurity object. The issue lies in how FilestackSecurity handles it's input. Here's a short debugger session to detail the issue.

[62, 71] in /home/taylor/code/ceremony/vendor/ruby/2.4.0/gems/filestack-2.1.0/lib/filestack/models/filestack_security.rb
   62:   #
   63:   # Manage options and convert hash to json string
   64:   #
   65:   def create_policy_string(options)
   66:     debugger
=> 67:     options[:expiry] = expiry_timestamp(options)
   68:     options.to_json
   69:   end
   70: 
   71:   #
(byebug) options
{"expiry"=>1514764799, "call"=>["pick", "read", "stat", "write", "writeUrl", "store", "convert", "remove", "exif"]}
(byebug) n

[63, 72] in /home/taylor/code/ceremony/vendor/ruby/2.4.0/gems/filestack-2.1.0/lib/filestack/models/filestack_security.rb
   63:   # Manage options and convert hash to json string
   64:   #
   65:   def create_policy_string(options)
   66:     debugger
   67:     options[:expiry] = expiry_timestamp(options)
=> 68:     options.to_json
   69:   end
   70: 
   71:   #
   72:   # Get expiration timestamp by adding seconds in option or using default
(byebug) options
{"expiry"=>1514764799, "call"=>["pick", "read", "stat", "write", "writeUrl", "store", "convert", "remove", "exif"], :expiry=>1509490768}
(byebug) n

[42, 51] in /home/taylor/code/ceremony/vendor/ruby/2.4.0/gems/filestack-2.1.0/lib/filestack/models/filestack_security.rb
   42:   #
   43:   # @param [String]   secret    Your filestack security secret
   44:   # @param [Hash]     options   Hash of options - see constructor
   45:   def generate(secret, options)
   46:     policy_json = create_policy_string(options)
=> 47:     @policy = Base64.urlsafe_encode64(policy_json)
   48:     @signature = OpenSSL::HMAC.hexdigest('sha256', secret, policy)
   49:   end
   50: 
   51:   # Sign the URL by appending policy and signature URL parameters
(byebug) policy_json
"{\"expiry\":1509490768,\"call\":[\"pick\",\"read\",\"stat\",\"write\",\"writeUrl\",\"store\",\"convert\",\"remove\",\"exif\"]}"
(byebug) 

The expiry_timestamp function adds a duplicate key to the options hash. It does this because it incorrectly uses a symbolized key :expiry instead of the string key 'expiry'. expiry_timestamp checks the wrong key, and thinks that there was no expiry key passed in to begin with, and offers the default expiry length of 1 hour. Using string keys instead of symbol keys in create_policy_string and expiry_timestamp fixes the problem. My solution will probably be to call .symbolize_keys on the options hash, ensuring that it doesn't matter whether the end user configures the gem using string keys or symbol keys.

All that said, I don't normally do pull requests or dig through gem source, so I'm not really sure what the process is for getting this change made in the filestack gem and then getting filestack-rails to accept the new version as a dependency - currently it requires 2.2.0. I'll submit a pull request. If i've done anything incorrectly, sorry!

How to get Exif data from an image already uploaded?

Hi! I'm trying to retrieve the Exif data from an already uploaded image (something like this issue #8).

Considerations:

# FilestackSecurity object is necessary to retrieve Exif data
security = FilestackSecurity.new(MY_APP_SECRET, options: { call: %w[read store pick exif] })

# FilestackFilelink objects are representation of a file handle. You can download, get raw file content, delete and overwrite file handles directly
filelink = FilestackFilelink.new('HANDLE', MY_API_KEY, security)

# Return metadata for file handle
puts filelink.metadata(:exif)

Doubts:

  1. I don't understand how a Filelink object represents just a single image when there is no specification about which one selects from the storage
  2. I don't get 'HANDLE' on filelink variable creation and where do I get it

Cheers,
Agustin.

How to work with already uploaded images?

Hi,

Is it possible to works with files already uploaded on filestack's servers (eg. via the javascript client)?

I would like to perform some operations in background, like resizing or rotating images. I have started few days ago an API wrapper for performing transform operation via the filestack's REST API (https://process.filestackapi.com) but maybe it will be a kind of duplication comparing to your gem?

What is the exact purpose of this gem?

Thank you

cannot load such file -- ./lib/filestack/ (LoadError)

Hi,

I've got the following error when I am trying to start my rails app:

/Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `require': cannot load such file -- ./lib/filestack/ (LoadError)
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `block in require'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:258:in `load_dependency'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `require'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/filestack-2.0.0/lib/filestack/models/filestack_client.rb:4:in `<top (required)>'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `require'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `block in require'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:258:in `load_dependency'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `require'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/filestack-2.0.0/lib/filestack.rb:2:in `<top (required)>'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:82:in `require'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:82:in `block (2 levels) in require'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:77:in `each'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:77:in `block in require'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:66:in `each'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:66:in `require'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.15.1/lib/bundler.rb:108:in `require'
	from /Users/jle/ror/MesPetitsArtistes/config/application.rb:7:in `<top (required)>'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/application.rb:92:in `require'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/application.rb:92:in `preload'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /Users/jle/.rbenv/versions/2.3.3/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from -e:1:in `<main>'

I've simply removed inclusion in lib/filestack/models/filestack_client.rb:4 and everything seems to be fine.

Question: Support bucket and path options in upload

I'd like to migrate a number of filestack files from one account to another and using the upload method from local path method. I wanted to ask if it supports providing a bucket and a path in the bucket, similarly to the JS SDK? Can't find it anywhere mentioned in the doc. Thanks!

Json Parse Error

Hi there!

We use this gem to upload to filestack but we get a bunch of JSON::ParserError anytime something goes wrong with the upload on filestack. Ideally the filestack server would be better about returning JSON even when something goes wrong, but I thought this gem could handle when the response is not in JSON as well.

Here is a PR with a proposed solution #69

Cannot load such file -- options (LoadError)

Version:

Ruby: 2.3.3
Rails: 4.2
Filestack: 2.3.0

Gemfile:

gem 'filestack', '2.3.0'

rails c:

/Users/huyvo/.rvm/gems/ruby-2.3.3/gems/bootsnap-1.1.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:19:in `require': cannot load such file -- options (LoadError)
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:274:in `block in require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:240:in `load_dependency'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:274:in `require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/progress_bar-0.3.1/lib/progress_bar.rb:2:in `<main>'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/bootsnap-1.1.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/bootsnap-1.1.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:274:in `block in require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:240:in `load_dependency'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:274:in `require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/filestack-2.3.0/lib/filestack/utils/multipart_upload_utils.rb:7:in `<main>'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/bootsnap-1.1.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/bootsnap-1.1.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:274:in `block in require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:240:in `load_dependency'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:274:in `require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/filestack-2.3.0/lib/filestack/mixins/filestack_common.rb:3:in `<main>'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/bootsnap-1.1.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/bootsnap-1.1.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:274:in `block in require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:240:in `load_dependency'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:274:in `require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/filestack-2.3.0/lib/filestack/models/filelink.rb:5:in `<main>'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/bootsnap-1.1.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/bootsnap-1.1.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:274:in `block in require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:240:in `load_dependency'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:274:in `require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/filestack-2.3.0/lib/filestack.rb:1:in `<main>'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/bootsnap-1.1.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/bootsnap-1.1.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/bundler-1.16.3/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/bundler-1.16.3/lib/bundler/runtime.rb:76:in `each'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/bundler-1.16.3/lib/bundler/runtime.rb:76:in `block in require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/bundler-1.16.3/lib/bundler/runtime.rb:65:in `each'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/bundler-1.16.3/lib/bundler/runtime.rb:65:in `require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/bundler-1.16.3/lib/bundler.rb:114:in `require'
        from /Users/huyvo/Projects/employment-hero/config/application.rb:6:in `<top (required)>'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/spring-1.7.2/lib/spring/application.rb:82:in `require'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/spring-1.7.2/lib/spring/application.rb:82:in `preload'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/spring-1.7.2/lib/spring/application.rb:143:in `serve'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/spring-1.7.2/lib/spring/application.rb:125:in `loop'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/spring-1.7.2/lib/spring/application.rb:125:in `run'
        from /Users/huyvo/.rvm/gems/ruby-2.3.3/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in `<top (required)>'
        from /Users/huyvo/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /Users/huyvo/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from -e:1:in `<main>'

Both filestack 2.3.0 and 2.4.0 results with the same error.

NoMethodError when mime type is unknown

With the replacement of mimemagic with mini_mime in #82, we're encountering a NoMethodError (undefined method 'content_type' for nil:NilClass) on file uploads where the mime type cannot be detected by the mini_mime gem.

Looking at the filestack-ruby code, it looks like you're assuming MiniMime.lookup_by_filename will always return a value, but this is not always the case.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.