Skip to content

Commit bbfe390

Browse files
committed
fix: match passthough envs with uppercased env names
1 parent 4545045 commit bbfe390

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

crates/vite_str/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ impl Str {
7171
pub fn push_str(&mut self, s: &str) {
7272
self.0.push_str(s);
7373
}
74+
75+
pub fn to_uppercase(&self) -> Self {
76+
Self(self.0.to_uppercase())
77+
}
78+
79+
pub fn to_lowercase(&self) -> Self {
80+
Self(self.0.to_lowercase())
81+
}
7482
}
7583

7684
impl AsRef<str> for Str {

crates/vite_task/src/execute.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ impl TaskEnvs {
258258
GlobPatternSet::new(task.config.envs.iter().filter(|s| !s.starts_with('!')))?;
259259
let sensitive_patterns = GlobPatternSet::new(SENSITIVE_PATTERNS)?;
260260
for (name, value) in &all_envs {
261-
if !envs_without_pass_through_patterns.is_match(name) {
261+
let upper_name = name.to_uppercase();
262+
if !envs_without_pass_through_patterns.is_match(&upper_name) {
262263
continue;
263264
}
264265
let Some(value) = value.to_str() else {
@@ -267,7 +268,7 @@ impl TaskEnvs {
267268
value: value.to_os_string(),
268269
});
269270
};
270-
let value: Str = if sensitive_patterns.is_match(name) {
271+
let value: Str = if sensitive_patterns.is_match(&upper_name) {
271272
let mut hasher = Sha256::new();
272273
hasher.update(value.as_bytes());
273274
format!("sha256:{:x}", hasher.finalize()).into()

0 commit comments

Comments
 (0)