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

Fix classpath relative-to-absolute conversion in DotenvReader #27

Merged
merged 2 commits into from
May 29, 2022

Conversation

Mooninaut
Copy link
Contributor

@Mooninaut Mooninaut commented May 25, 2022

Escape . to prevent removing the trailing character from a simple directory name with no leading / or ./

Anchor the regex to prevent stripping a trailing literal . from a directory name, which is unlikely but possible

Add tests for simple resource directory and resource directory with trailing .

Examples of bug:
.directory("envdir") would try to load resources/envdi/.env and fail
.directory("/trailingdot./envdir") would try to load resources/trailingdot/envdir/.env and fail

Workaround: Always prefix classpath-relative directories with ./

Clement Cherlin added 2 commits May 25, 2022 09:54
Escape "." to prevent removing the trailing character from a simple directory name with no leading "/" or "./"

Anchor the regex to prevents stripping a trailing literal "." from a directory name, which is unlikely but possible

Add tests for simple resource directory and resource directory with trailing "."

Examples of bug:
.directory("envdir") would try to load "resources/envdi/.env" and fail.
.directory("/trailingdot./envdir") would try to load "resources/trailingdot/envdir/.env") and fail.
@cdimascio cdimascio merged commit 6dc4c52 into cdimascio:master May 29, 2022
@cdimascio
Copy link
Owner

@all-contributors add @Mooninaut for code and test

@allcontributors
Copy link
Contributor

@cdimascio

I've put up a pull request to add @Mooninaut! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants