@@ -20,6 +20,7 @@ import (
20
20
"fmt"
21
21
"net/url"
22
22
"path/filepath"
23
+ "runtime"
23
24
"strings"
24
25
"time"
25
26
@@ -472,7 +473,7 @@ func UpdateIndex(ctx context.Context, req *rpc.UpdateIndexRequest, downloadCB rp
472
473
failed := false
473
474
result := & rpc.UpdateIndexResponse_Result {}
474
475
for _ , u := range urls {
475
- URL , err := utils . URLParse (u )
476
+ URL , err := url . Parse (u )
476
477
if err != nil {
477
478
logrus .Warnf ("unable to parse additional URL: %s" , u )
478
479
msg := fmt .Sprintf ("%s: %v" , tr ("Unable to parse URL" ), err )
@@ -487,6 +488,11 @@ func UpdateIndex(ctx context.Context, req *rpc.UpdateIndexRequest, downloadCB rp
487
488
488
489
if URL .Scheme == "file" {
489
490
path := paths .New (URL .Path )
491
+ if URL .Scheme == "file" && runtime .GOOS == "windows" && len (URL .Path ) > 1 {
492
+ // https://github.com/golang/go/issues/32456
493
+ // Parsed local file URLs on Windows are returned with a leading / so we remove it
494
+ path = paths .New (URL .Path [1 :])
495
+ }
490
496
if _ , err := packageindex .LoadIndexNoSign (path ); err != nil {
491
497
msg := fmt .Sprintf ("%s: %v" , tr ("Invalid package index in %s" , path ), err )
492
498
downloadCB .Start (u , tr ("Downloading index: %s" , filepath .Base (URL .Path )))
0 commit comments