File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -21,9 +21,11 @@ import (
2121 "encoding/json"
2222 "fmt"
2323 "net/url"
24+ "path/filepath"
2425 "sort"
2526 "strings"
2627
28+ "github.com/arduino/arduino-cli/arduino/globals"
2729 "github.com/arduino/arduino-cli/arduino/resources"
2830 "github.com/arduino/arduino-cli/arduino/utils"
2931 "github.com/arduino/arduino-cli/i18n"
@@ -360,8 +362,13 @@ func (release *PlatformRelease) String() string {
360362
361363// ToRPCPlatformReference creates a gRPC PlatformReference message out of this PlatformRelease
362364func (release * PlatformRelease ) ToRPCPlatformReference () * rpc.InstalledPlatformReference {
365+ defaultUrlPrefix := globals .DefaultIndexURL
366+ // TODO: create a IndexURL object to factorize this
367+ defaultUrlPrefix = strings .TrimSuffix (defaultUrlPrefix , filepath .Ext (defaultUrlPrefix ))
368+ defaultUrlPrefix = strings .TrimSuffix (defaultUrlPrefix , filepath .Ext (defaultUrlPrefix )) // removes .tar.bz2
369+
363370 url := release .Platform .Package .URL
364- if strings .HasPrefix (url , "https://downloads.arduino.cc/packages/package_index." ) {
371+ if strings .HasPrefix (url , defaultUrlPrefix ) {
365372 url = ""
366373 }
367374 return & rpc.InstalledPlatformReference {
You can’t perform that action at this time.
0 commit comments