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

filename_from_header compatibility #2364

Closed
ghost opened this issue Jan 4, 2019 · 0 comments
Closed

filename_from_header compatibility #2364

ghost opened this issue Jan 4, 2019 · 0 comments

Comments

@ghost
Copy link

ghost commented Jan 4, 2019

{"cache-control"=>"private", "content-type"=>"binary/octet-stream", "server"=>"Microsoft-IIS/8.5", "content-disposition"=>"attachment; filename=13134102.pdf; size=426665", "x-powered-by"=>"ASP.NET", "date"=>"Fri, 04 Jan 2019 15:20:47 GMT", "content-length"=>"426665"}

support above file meta.

    def filename_from_header
      if file.meta.include? 'content-disposition'
        match = file.meta['content-disposition'].match(/filename="?([^"|;]+)/)
        return match[1] unless match.nil? || match[1].empty?
      end
    end
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