Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

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

wants to merge 3 commits into from

Conversation

songintae
Copy link

@songintae songintae commented Jan 16, 2022

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 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

💡 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:
- 's3://bucketName/admin/beta/'

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.

💚 How did you test it?

Modified the existing test code.

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • I updated reference documentation to reflect the change
  • All tests passing
  • No breaking changes

🔮 Next steps

@pivotal-cla
Copy link

@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.

2 similar comments
@pivotal-cla
Copy link

@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
Copy link

@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.

@github-actions github-actions bot added component: core An issue related to core functionality - credentials, region resolution component: s3 S3 integration related issue labels Jan 16, 2022
@pivotal-cla
Copy link

@songintae Thank you for signing the Contributor License Agreement!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
component: core An issue related to core functionality - credentials, region resolution component: s3 S3 integration related issue
Development

Successfully merging this pull request may close these issues.

2 participants