Skip to content

Commit

Permalink
chore: use a more compatible splicing method in CustomServer
Browse files Browse the repository at this point in the history
  • Loading branch information
r3inbowari committed Apr 24, 2024
1 parent a76e225 commit c15f96c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions speedtest/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"math"
"net/http"
"net/url"
"path"
"sort"
"strconv"
"strings"
Expand Down Expand Up @@ -76,15 +75,13 @@ func (s *Speedtest) CustomServer(host string) (*Server, error) {
if err != nil {
return nil, err
}
if path.Base(u.Path) != "upload.php" {
return nil, errors.New("please use the full URL of the server, ending in '/upload.php'")
}
parseHost := fmt.Sprintf("%s://%s%s", u.Scheme, u.Host, "/speedtest/upload.php")
return &Server{
ID: "Custom",
Lat: "?",
Lon: "?",
Country: "?",
URL: host,
URL: parseHost,
Name: u.Host,
Host: u.Host,
Sponsor: "?",
Expand Down

0 comments on commit c15f96c

Please sign in to comment.