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

Resource location does not end with slash #34509

Open
ecabrera78 opened this issue Feb 27, 2025 · 0 comments
Open

Resource location does not end with slash #34509

ecabrera78 opened this issue Feb 27, 2025 · 0 comments
Labels
status: waiting-for-triage An issue we've not yet triaged or decided on

Comments

@ecabrera78
Copy link

I migrated an application from spring-boot 3.3.6 to 3.4.2. We have below code to create a static resource locator:

@Bean
RouterFunction staticResourceLocator() {
  return RouterFunctions.resources("/**", new FileSystemResource("/opt/cfg/static/"));
}

After the migration this code is throwing an exception:
Failed to instantiate [org.springframewok.we.reactive.function.server.RouterFunction]: Factory method 'stticResourceLocator' threw exception with message: Resource location does not end with slash: /opt/cfg/static

I found that when FileSystemResource is created there is a call to StringUtils.cleanPath(path) where the last slash is removed from the original path.

is there another way to create the FileSystemResource and preserve the last slash?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged or decided on
Projects
None yet
Development

No branches or pull requests

2 participants