Skip to content

Commit cd0c9f4

Browse files
committed
Resolves an issue whereby non-strings can be passed into the config switch detector.
Closes #866
1 parent e1d66b6 commit cd0c9f4

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/unlucky-dragons-fry.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'simple-git': patch
3+
---
4+
5+
Resolves an issue whereby non-strings can be passed into the config switch detector.

simple-git/src/lib/plugins/block-unsafe-operations-plugin.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import type { SimpleGitPlugin } from './simple-git-plugin';
33
import { GitPluginError } from '../errors/git-plugin-error';
44
import type { SimpleGitPluginConfig } from '../types';
55

6-
function isConfigSwitch(arg: string) {
7-
return arg.trim().toLowerCase() === '-c';
6+
function isConfigSwitch(arg: string | unknown) {
7+
return typeof arg === 'string' && arg.trim().toLowerCase() === '-c';
88
}
99

1010
function preventProtocolOverride(arg: string, next: string) {

0 commit comments

Comments
 (0)