Skip to content

Commit e11692f

Browse files
committed
Process input to Configure
1 parent f2ef459 commit e11692f

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2424
- Added feedback to settings page (#550)
2525
- Fix "Home" navigation to point to current namespace (#548)
2626
- Force export of item if it has been modified (#354)
27+
- Remove leading/trailing spaces from input to Configure() (#356)
2728

2829
## [2.6.0] - 2024-10-07
2930

cls/SourceControl/Git/Settings.cls

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ ClassMethod Configure() As %Boolean [ CodeMode = objectgenerator ]
180180
do %code.WriteLine(" set valid = 0")
181181
do %code.WriteLine(" while ('valid) {")
182182
do %code.WriteLine(" set response = ##class(%Library.Prompt).GetString("_promptQuoted_",.value,,,,"_defaultPromptFlag_")")
183+
do %code.WriteLine(" set value = inst.CleanInput(value)")
183184
do %code.WriteLine(" set status = inst.ConfigureBinPath(.value)")
184185
do %code.WriteLine(" if (status) { set valid = 1 }")
185186
do %code.WriteLine(" }")
@@ -206,6 +207,7 @@ ClassMethod Configure() As %Boolean [ CodeMode = objectgenerator ]
206207
do %code.WriteLine(" set response = ##class(%Library.Prompt).GetString("_promptQuoted_",.value,,,,"_defaultPromptFlag_")")
207208
}
208209
do %code.WriteLine(" if response '= $$$SuccessResponse { quit 0 }")
210+
do %code.WriteLine(" set value = inst.CleanInput(value)")
209211
do %code.WriteLine(" set inst."_property_" = value")
210212

211213
}
@@ -386,4 +388,16 @@ Method ConfigureBinPath(ByRef path As %String) As %Boolean
386388
return 1
387389
}
388390

391+
ClassMethod CleanInput(value As %String)
392+
{
393+
while ($extract(value,1) = " ") || ($extract(value,1) = $char(9)) {
394+
set value = $extract(value,2,$length(value))
395+
}
396+
397+
while ($extract(value, $length(value)) = " ") || ($extract(value,$length(value)) = $char(9)) {
398+
set value = $extract(value,1,$length(value) - 1)
399+
}
400+
return value
401+
}
402+
389403
}

0 commit comments

Comments
 (0)