Skip to content

UrlResource getFilename should not contain query parameters [SPR-15411] #19974

Closed

Description

@spring-projects-issues

Jerome Hordies opened SPR-15411 and commented

UrlResource.getFilename uses URL.getFile() instead of URL.getPath()

The URL.getFile() javadocs say :
Gets the file name of this URL. The returned file portion will be the same as getPath(), plus the concatenation of the value of getQuery(), if any. If there is no query portion, this method and getPath() will return identical results.

This causes a bug in Spring boot when specifying --spring.config.location=http://host/group/repo/raw/branch/config.yml?private_token=NyAq4wDit3hmJ7UZPyMU because ".yml?private_token=NyAq4wDit3hmJ7UZPyMU" is not a supported extension.

My workaround until this gets fixed is to use --spring.config.location=http://host/group/repo/raw/branch/config.yml?private_token=NyAq4wDit3hmJ7UZPyMU&fake_param=whatever.yml


Affects: 3.2.18, 4.2.9, 4.3.7, 5.0 M5

Reference URL: #1372

Issue Links:

Activity

  1. spring-projects-issues commented on Apr 6, 2017

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    Thanks for raising this! I've revised UrlResource.getFilename overall, taking URL.getPath() as a starting point and then applying our StringUtils.getFilename delegate, in alignment with other Resource implementations.

  2. added
    type: bug
    in: core
    on Jan 11, 2019
  3. added this to the 4.3.8 milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: coretype: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions