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

getContentDispositionFilename uses encodedFilename in both parameters where decoded one should be used #12591

Open
mimkorn opened this issue Jul 13, 2023 · 0 comments

Comments

@mimkorn
Copy link

mimkorn commented Jul 13, 2023

/**
 * Returns the filename formatted for inclusion in a Content-Disposition
 * header. Includes both a plain version of the name and a UTF-8 version
 *
 * @since 7.4.8
 * @param filename
 *            The filename to include
 * @return A value for inclusion in a Content-Disposition header
 */
public static String getContentDispositionFilename(String filename) {
    String encodedFilename = EncodeUtil.rfc5987Encode(filename);

    return String.format("filename=\"%s\"; filename*=utf-8''%s",
            encodedFilename, encodedFilename);

Observe that you use encodedFilename in both cases instead of using filename in one case and encodedFilename in the other.

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