GithubHelp home page GithubHelp logo

Comments (3)

dougwilson avatar dougwilson commented on August 22, 2024

Thanks for the information! This module purely follows the RFC, though.

You can find information regarding the specification in the references section https://github.com/jshttp/content-disposition/blob/master/README.md#references

The RFC says a trailing semicolon is not valid (and I copied the ABNF you can read into the comments of this module).

I would say to let them know they have buggy headers and you may want to apply that regular expression to responses you know have buggy headers before trying to parse.

from content-disposition.

danielgindi avatar danielgindi commented on August 22, 2024

I figured you'd say that, but browsers do "forgive" trailing semicolons and parse the header to supply correct filenames when downloading - so maybe it should be an option.

In any case - the information is here for someone to find it when wanting to know how to avoid those nasty semicolons :-)

from content-disposition.

dougwilson avatar dougwilson commented on August 22, 2024

Yea, I know they forgive a lot of things in a lot of ways (though there are various things Firefox has been trying to tighten, since being too forgiving ends up leading to bugs in parsing). Currently this module is primarily used to format a the header (so you can generate actually valid headers; too many people think they can just get away with string concatenation because "it's not that hard") and the parse is being dual-used to parse and validate.

I think if there is some kind of new major version releases that does more forgiving parsing, we need to take a survey of the Internet to determine what is actually the common mistakes in the header values to even understand what we need to parse, otherwise how can we come up with a parser?

from content-disposition.

Related Issues (20)

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.