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

Incorrect filename when downloading asset embedded within Download component #2748

Open
HitmanInWis opened this issue May 7, 2024 · 0 comments

Comments

@HitmanInWis
Copy link

Bug Version: 2.24.7-SNAPSHOT

When downloading a file that is directly uploaded to a Download component, the filename put into the Content-Disposition header is prepended with /, which results in the file being downloaded (at least in Chrome) with a prefixed _ character. i.e. file name uploaded = "myfile.txt", but downloads as "_myfile.txt"

The issue appears to be in com.adobe.cq.wcm.core.components.internal.servlets.DownloadServlet

In the doGet function,

        if (asset == null) {
            String filename = request.getRequestPathInfo().getSuffix();

Should be updated to

        if (asset == null) {
            String filename = StringUtils.removeStart(request.getRequestPathInfo().getSuffix(), '/');
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