Skip to content

PathMatchingResourcePatternResolver no longer finds directories #29333

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

Closed
spencergibb opened this issue Oct 17, 2022 · 5 comments
Closed

PathMatchingResourcePatternResolver no longer finds directories #29333

spencergibb opened this issue Oct 17, 2022 · 5 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: regression A bug that is also a regression
Milestone

Comments

spencergibb added a commit to spring-cloud/spring-cloud-config that referenced this issue Oct 17, 2022
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Oct 17, 2022
@sbrannen
Copy link
Member

sbrannen commented Oct 18, 2022

I imagine this is due to the change in d21eea7, since we explicitly only return "regular files" as a result of that.

@wilkinsona had reported a regression in that we started returning directories and had not done so before.

And now this issue is claiming that we did previously return directories and no longer do.

So these two claims seem to contradict, but perhaps it's due to a nuance in the patterns that are used.

@sbrannen
Copy link
Member

I just confirmed that removing Files.isRegularFile(path) from the isMatchingFile predicate in PathMatchingResourcePatternResolver.doFindPathMatchingFileResources() allows the configdir/subdir to be found again (as was to be expected).

So if we revert that change, we'll need to investigate a different solution to the issue raised by @wilkinsona.

@wilkinsona
Copy link
Member

spring-projects/spring-boot@7eb8abb is the change that I had to make when the behaviour first changed and spring-projects/spring-boot@03b3a77 is the change after d21eea7. Hopefully the tests that were affected show the patterns that were involved.

@sbrannen sbrannen added the in: core Issues in core modules (aop, beans, core, context, expression) label Oct 18, 2022
@sbrannen
Copy link
Member

It looks like the difference between returning directories and not is that a pattern like subdir/** now (in Framework 6) returns subdir/ as a matching resource; whereas, in Framework 5.3.x and prior subdir/** did not match against subdir/.

@sbrannen sbrannen added type: regression A bug that is also a regression and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Oct 18, 2022
@sbrannen sbrannen added this to the 6.0.0 milestone Oct 18, 2022
@sbrannen
Copy link
Member

Update: I do not have time to resolve this issue before the 6.0 RC2 release tomorrow; however, I have checked in tests that verify the status quo for 5.3.x and merged those to main (with failing tests @Disabled) in 0048756.

The disabled tests should help us to sort out the differences between 5.3.x and main.

@jhoeller jhoeller self-assigned this Oct 18, 2022
@jhoeller jhoeller modified the milestones: 6.0.0, 6.0.0-RC2 Oct 18, 2022
@sbrannen sbrannen self-assigned this Oct 20, 2022
@sbrannen sbrannen changed the title Possible regression in PathMatchingResourcePatternResolver PathMatchingResourcePatternResolver no longer finds folders Oct 20, 2022
@sbrannen sbrannen changed the title PathMatchingResourcePatternResolver no longer finds folders PathMatchingResourcePatternResolver no longer finds directories Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: regression A bug that is also a regression
Projects
None yet
Development

No branches or pull requests

5 participants