We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0b3d2c0 commit a0b7503Copy full SHA for a0b7503
git2-hooks/src/hookspath.rs
@@ -134,7 +134,22 @@ impl HookPaths {
134
);
135
os_str.push(hook.replace('\'', REPLACEMENT));
136
} else {
137
- os_str.push(hook.as_os_str()); // TODO: this doesn't work if `hook` contains single-quotes
+ #[cfg(windows)]
138
+ {
139
+ use std::os::windows::ffi::OsStrExt;
140
+ if hook
141
+ .as_os_str()
142
+ .encode_wide()
143
+ .into_iter()
144
+ .find(|x| *x == (b'\'' as u16))
145
+ .is_some()
146
147
+ // TODO: escape single quotes instead of failing
148
+ return Err(HooksError::PathToString);
149
+ }
150
151
+
152
+ os_str.push(hook.as_os_str());
153
}
154
os_str.push("'");
155
os_str.push(" \"$@\"");
0 commit comments