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 48922ce commit 9649e84Copy full SHA for 9649e84
git2-hooks/src/hookspath.rs
@@ -146,7 +146,22 @@ impl HookPaths {
146
if let Some(hook) = hook.to_str() {
147
os_str.push(hook.replace('\'', REPLACEMENT));
148
} else {
149
- os_str.push(hook.as_os_str()); // TODO: this doesn't work if `hook` contains single-quotes
+ #[cfg(windows)]
150
+ {
151
+ use std::os::windows::ffi::OsStrExt;
152
+ if hook
153
+ .as_os_str()
154
+ .encode_wide()
155
+ .into_iter()
156
+ .find(|x| *x == (b'\'' as u16))
157
+ .is_some()
158
159
+ // TODO: escape single quotes instead of failing
160
+ return Err(HooksError::PathToString);
161
+ }
162
163
+
164
+ os_str.push(hook.as_os_str());
165
}
166
os_str.push("'");
167
os_str.push(" \"$@\"");
0 commit comments