+16
-3
lines changedFilter options
+16
-3
lines changed Original file line number Diff line number Diff line change
@@ -348,7 +348,15 @@ function Invoke-GHRestMethod
348
348
349
349
if (-not (Get-GitHubConfiguration -Name DisableSmarterObjects))
350
350
{
351
-
$finalResult = ConvertTo-SmarterObject -InputObject $finalResult
351
+
# In the case of getting raw content from the repo, we'll end up with a large object/byte
352
+
# array which isn't convertible to a smarter object, but by _trying_ we'll end up wasting
353
+
# a lot of time. Let's optimize here by not bothering to send in something that we
354
+
# know is definitely not convertible ([int32] on PS5, [long] on PS7).
355
+
if (($finalResult -isnot [Object[]]) -or
356
+
(($finalResult.Count -gt 0) -and ($finalResult[0] -isnot [int]) -and ($finalResult[0] -isnot [long])))
357
+
{
358
+
$finalResult = ConvertTo-SmarterObject -InputObject $finalResult
359
+
}
352
360
}
353
361
354
362
$links = $result.Headers['Link'] -split ','
@@ -900,7 +908,13 @@ filter ConvertTo-SmarterObject
900
908
return $null
901
909
}
902
910
903
-
if ($InputObject -is [System.Collections.IList])
911
+
if (($InputObject -is [int]) -or ($InputObject -is [long]))
912
+
{
913
+
# In some instances, an int/long was being seen as a [PSCustomObject].
914
+
# This attempts to short-circuit extra work we would have done had that happened.
915
+
Write-Output -InputObject $InputObject
916
+
}
917
+
elseif ($InputObject -is [System.Collections.IList])
904
918
{
905
919
$InputObject |
906
920
ConvertTo-SmarterObject |
Original file line number Diff line number Diff line change
@@ -28,7 +28,6 @@ try
28
28
for ($i = 0; $i -lt 4; $i++)
29
29
{
30
30
$newIssues += New-GitHubIssue -OwnerName $script:ownerName -RepositoryName $repo.name -Title ([guid]::NewGuid().Guid)
31
-
Start-Sleep -Seconds 5
32
31
}
33
32
34
33
$newIssues[0] = Update-GitHubIssue -OwnerName $script:ownerName -RepositoryName $repo.name -Issue $newIssues[0].number -State Closed
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4