Giter VIP home page Giter VIP logo

rack-content_disposition_helper's Introduction

GitHub Actions Maintainability Gem Version GitHub

Rack::ContentDispositionHelper

Rack::ContentDispositionHelper is Rack middleware that rewrites the decoded filename* directive in the Content-Disposition response header as the value of the filename directive.

Safari does not use filename* if the size of the Content-Disposition response header exceeds 254Bytes, but this middleware is helpful in such cases.

This middleware checks that the User-Agent value in the request header is Safari-like. If the User-Agent is not Safari-like, no processing is performed.

Usage example

Rails app

Add this line to your application's Gemfile:

# Gemfile
gem 'rack-content_disposition_helper'

And then execute:

$ bundle

This will load rack-content_disposition_helper and set it up as a Rails middleware. The middleware is inserted for all of environment.

You don't need to add middleware to rails middleware stack.

Sinatra and other Rack apps

Add this line to your application's Gemfile:

# Gemfile
gem 'rack-content_disposition_helper'

And then execute:

$ bundle

For Sinatra and other Rack apps, add this to config.ru:

# config.ru

# Bundler.require or require 'rack/content_disposition_helper'
use Rack::ContentDispositionHelper

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/hana-da/rack-content_disposition_helper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Rack::ContentDispositionHelper project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

rack-content_disposition_helper's People

Contributors

hana-da avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

 avatar

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.