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

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

Closed
wants to merge 1 commit into from
Closed

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

wants to merge 1 commit into from

Conversation

willome
Copy link
Contributor

@willome willome commented Apr 29, 2022

📢 Type of change

  • [ x ] Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

(this PR is a copy/patse from the legacy repository spring-attic/spring-cloud-aws#805 made by @songintae)

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.

AmazonS3
SimpleStorageProtocolResolver
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
  • [ x ] I added tests to verify changes
  • I updated reference documentation to reflect the change
  • [ x ] All tests passing
  • [ x ] No breaking changes

🔮 Next steps

@github-actions github-actions bot added the component: core Core functionality related issue label Apr 29, 2022
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug C 8 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 166 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@willome willome closed this Apr 29, 2022
@willome willome deleted the bugfix-simple-storage-resource branch April 29, 2022 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: core Core functionality related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant