-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Line 90 in 0791fac
| foreach($instance in $instanceUrls.Trim().Split(",")) |
I would recommend changing the line as follows (code expandable for readability. I personally don't follow that best practice):
foreach($instance in $instanceUrls.Split(',') | %{$_.Trim()} | ? {$_ -notmatch '^\s*$'})
This solves multiple issues:
- If the incoming $instanceUrls contains multiple entries and a space before or after the comma, then each url will be trimmed individually
- Also ensures that only URLs containing data is present
- We could actually force it to match service-now.com in the URL (or add it altogether, with more code)
- As per VSCode PoSH best practices, if a string doesn't need variable expansion, then best to use single quotes
- We could as well put the Where-Object before the For-Each, to filter out before trimming. Haven't checked what is the most efficient.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request