Skip to content

Expand environment variables prior to detecting scheme#2394

Merged
charliermarsh merged 2 commits intomainfrom
charlie/expand
Mar 12, 2024
Merged

Expand environment variables prior to detecting scheme#2394
charliermarsh merged 2 commits intomainfrom
charlie/expand

Conversation

@charliermarsh
Copy link
Member

Summary

This PR ensures that we expand environment variables before sniffing for the URL scheme (e.g., file:// vs. https:// vs. something else).

Closes #2375.

@charliermarsh charliermarsh added the bug Something isn't working label Mar 12, 2024
std::env::var(name).unwrap_or_else(|_| match name {
// Ensure that the variable is URL-escaped, if necessary.
"PROJECT_ROOT" => match escape {
Escape::Url => PROJECT_ROOT_FRAGMENT.replace(' ', "%20"),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this isn't necessary. If the root is in a file://, we already strip that as a special case and parse this as a path, so spaces are fine.

@charliermarsh charliermarsh force-pushed the charlie/expand branch 2 times, most recently from eb63ed6 to 0b4fa81 Compare March 12, 2024 21:00
@charliermarsh charliermarsh force-pushed the charlie/expand branch 4 times, most recently from a8cf59d to ffc16bd Compare March 12, 2024 21:07
@charliermarsh charliermarsh marked this pull request as ready for review March 12, 2024 23:17
@charliermarsh charliermarsh merged commit 7220894 into main Mar 12, 2024
@charliermarsh charliermarsh deleted the charlie/expand branch March 12, 2024 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

URL Environment Variable Substitution ordering

2 participants