Skip to content

WebApi.downloadURL() does not honour filename Content-Disposition response header #190

@fulcrum-stelios-papadopoulos

Description

I cannot get WebApi.downloadURL() to honour the filename returned in the response headers.

I don't know how to see what headers are returned by the jpro url .../resourcesdownload/http:/..., as once the browser opens it, it seems to be gone. So my guess is that the content disposition header is not proxied. (of course it could be some misuse/misconfiguration on my part, if so please advise)

Example:
Non Jpro endpoint http://host/file/1234 returns a file as octet stream.

It also returns a header Content-Disposition: attachment; filename=foo.txt

When accessing the above URL on a browser the file is saved as foo.txt, but when calling webApi.downloadURL("http://host/file/1234") the file downloaded by the browser is saved as 1234

I would expect the file to be saved as foo.txt and only use the last part of the URL if no Content-Disposition header with an filename is provided.

JPRO version: 2024.3.3

Chrome: Version 130.0.6723.92 (Official Build) (64-bit)

java:
openjdk version "21.0.5" 2024-10-15 LTS
OpenJDK Runtime Environment Temurin-21.0.5+11 (build 21.0.5+11-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.5+11 (build 21.0.5+11-LTS, mixed mode, sharing)

server OS:
Linux 3230f1148631 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

using jpro release

edits: grammar

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions