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

Response filename not escaped in Content-Disposition Header #521

Open
lambdaupb opened this issue Oct 8, 2019 · 1 comment
Open

Response filename not escaped in Content-Disposition Header #521

lambdaupb opened this issue Oct 8, 2019 · 1 comment

Comments

@lambdaupb
Copy link
Contributor

Related to #344 and #344

    public Response filenameHeader(String filename) {
        if (filename != null && !filename.isEmpty()) {
            header(HttpConstants.Header.CONTENT_DISPOSITION, "attachment; filename=\"" + filename + "\"");
        } else {
            header(HttpConstants.Header.CONTENT_DISPOSITION, "attachment; filename=\"\"");
        }

        return this;
    }

Does not escape the filename.
For example " inside it will break header parsing for the client.

See https://stackoverflow.com/questions/93551/how-to-encode-the-filename-parameter-of-content-disposition-header-in-http

Also FileItem does not un-escape the filename upon reading the Content-Disposition Header.

@decebals
Copy link
Member

decebals commented Nov 5, 2019

@lambdaupb
Can you supply a PR with a solution to this problem? Thanks!

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

2 participants