spring-attic / spring-cloud-aws

All development has moved to https://github.com/awspring/spring-cloud-aws Integration for Amazon Web Services APIs with Spring
https://awspring.io/
Apache License 2.0
590 stars 373 forks source link

Exclude Slash from Encode, when calling getURL() #805

Open songintae opened 2 years ago

songintae commented 2 years ago

:loudspeaker: Type of change

:scroll: Description

In the PathResourceResolver.isResourceUnderLocation method, a slash is placed in the locationPath to verify the resource. Therefore, the slash should be excluded when encoding the object name.

PathResourceResolver class : org.springframework.web.servlet.resource.PathResourceResolver

:bulb: Motivation and Context

I am using S3 to manage static resources. Using the spring, I wrote the setting code as follows.

-- application.yml spring.resources.staticLocations:

And I registered the following Beans.

  1. AmazonS3
  2. SimpleStorageProtocolResolver
  3. SimpleStorageProtocolResolverConfigurer

In this environment, when I make a request such as "https://domain.com/index.html", the PathResourceResolver.isResourceUnderLocation method does not find the file correctly due to URL encoding problems.

:green_heart: How did you test it?

Modified the existing test code.

:pencil: Checklist

:crystal_ball: Next steps

pivotal-cla commented 2 years ago

@songintae Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

pivotal-cla commented 2 years ago

@songintae Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

pivotal-cla commented 2 years ago

@songintae Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

pivotal-cla commented 2 years ago

@songintae Thank you for signing the Contributor License Agreement!