Skip to content

Commit 6403de9

Browse files
committed
Fix OAuth URL capture from rclone stderr
1 parent a102889 commit 6403de9

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

‎tools/orthodox-drive/Orthodox-Drive-Downloader.ps1‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,16 @@ function Get-AuthToken([string]$ClientId='', [string]$ClientSecret='') {
6060

6161
for($i=0;$i -lt 180 -and -not $p.HasExited;$i++){
6262
Start-Sleep 1
63-
if(Test-Path $out){
64-
$t = Get-Content $out -Raw -ErrorAction SilentlyContinue
65-
if($t){
66-
$m = [regex]::Match($t,'https?://127\.0\.0\.1:\d+/auth(?:\?state=\S+)?')
67-
if($m.Success){
68-
Write-Host ' Opening Google authorization in the default browser...'
69-
Start-Process $m.Value
70-
break
71-
}
63+
$t = ''
64+
if(Test-Path $out){ $t += (Get-Content $out -Raw -ErrorAction SilentlyContinue) }
65+
if(Test-Path $err){ $t += (Get-Content $err -Raw -ErrorAction SilentlyContinue) }
66+
67+
if($t){
68+
$m = [regex]::Match($t,'https?://127\.0\.0\.1:\d+/auth(?:\?state=\S+)?')
69+
if($m.Success){
70+
Write-Host ' Opening Google authorization in the default browser...'
71+
Start-Process $m.Value
72+
break
7273
}
7374
}
7475
}

0 commit comments

Comments
 (0)