Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot]
60ef1c4af8 build(deps): bump github.com/buger/jsonparser from 1.1.1 to 1.1.2
Bumps [github.com/buger/jsonparser](https://github.com/buger/jsonparser) from 1.1.1 to 1.1.2.
- [Release notes](https://github.com/buger/jsonparser/releases)
- [Commits](https://github.com/buger/jsonparser/compare/v1.1.1...v1.1.2)

---
updated-dependencies:
- dependency-name: github.com/buger/jsonparser
  dependency-version: 1.1.2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-28 23:43:24 +00:00
4 changed files with 11 additions and 34 deletions

4
go.mod
View File

@@ -13,7 +13,7 @@ require (
github.com/apex/log v1.9.0 github.com/apex/log v1.9.0
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
github.com/beevik/etree v1.5.0 github.com/beevik/etree v1.5.0
github.com/buger/jsonparser v1.1.1 github.com/buger/jsonparser v1.1.2
github.com/cenkalti/backoff/v4 v4.3.0 github.com/cenkalti/backoff/v4 v4.3.0
github.com/creasty/defaults v1.8.0 github.com/creasty/defaults v1.8.0
github.com/docker/docker v28.3.3+incompatible github.com/docker/docker v28.3.3+incompatible
@@ -45,6 +45,7 @@ require (
golang.org/x/crypto v0.46.0 golang.org/x/crypto v0.46.0
golang.org/x/sync v0.19.0 golang.org/x/sync v0.19.0
golang.org/x/sys v0.39.0 golang.org/x/sys v0.39.0
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af
gopkg.in/ini.v1 v1.67.0 gopkg.in/ini.v1 v1.67.0
gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1 gopkg.in/yaml.v3 v3.0.1
@@ -132,7 +133,6 @@ require (
golang.org/x/net v0.47.0 // indirect golang.org/x/net v0.47.0 // indirect
golang.org/x/term v0.38.0 // indirect golang.org/x/term v0.38.0 // indirect
golang.org/x/text v0.32.0 // indirect golang.org/x/text v0.32.0 // indirect
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
google.golang.org/protobuf v1.36.5 // indirect google.golang.org/protobuf v1.36.5 // indirect
gotest.tools/v3 v3.0.2 // indirect gotest.tools/v3 v3.0.2 // indirect

4
go.sum
View File

@@ -57,8 +57,8 @@ github.com/bodgit/sevenzip v1.6.1 h1:kikg2pUMYC9ljU7W9SaqHXhym5HyKm8/M/jd31fYan4
github.com/bodgit/sevenzip v1.6.1/go.mod h1:GVoYQbEVbOGT8n2pfqCIMRUaRjQ8F9oSqoBEqZh5fQ8= github.com/bodgit/sevenzip v1.6.1/go.mod h1:GVoYQbEVbOGT8n2pfqCIMRUaRjQ8F9oSqoBEqZh5fQ8=
github.com/bodgit/windows v1.0.1 h1:tF7K6KOluPYygXa3Z2594zxlkbKPAOvqr97etrGNIz4= github.com/bodgit/windows v1.0.1 h1:tF7K6KOluPYygXa3Z2594zxlkbKPAOvqr97etrGNIz4=
github.com/bodgit/windows v1.0.1/go.mod h1:a6JLwrB4KrTR5hBpp8FI9/9W9jJfeQ2h4XDXU74ZCdM= github.com/bodgit/windows v1.0.1/go.mod h1:a6JLwrB4KrTR5hBpp8FI9/9W9jJfeQ2h4XDXU74ZCdM=
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= github.com/buger/jsonparser v1.1.2 h1:frqHqw7otoVbk5M8LlE/L7HTnIq2v9RX6EJ48i9AxJk=
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/buger/jsonparser v1.1.2/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
github.com/bytedance/sonic v1.13.1 h1:Jyd5CIvdFnkOWuKXr+wm4Nyk2h0yAFsr8ucJgEasO3g= github.com/bytedance/sonic v1.13.1 h1:Jyd5CIvdFnkOWuKXr+wm4Nyk2h0yAFsr8ucJgEasO3g=
github.com/bytedance/sonic v1.13.1/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4= github.com/bytedance/sonic v1.13.1/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4=
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=

View File

@@ -25,7 +25,6 @@ var client *http.Client
func init() { func init() {
dialer := &net.Dialer{ dialer := &net.Dialer{
LocalAddr: nil, LocalAddr: nil,
Timeout: time.Second * 30,
} }
trnspt := http.DefaultTransport.(*http.Transport).Clone() trnspt := http.DefaultTransport.(*http.Transport).Clone()
@@ -56,8 +55,10 @@ func init() {
} }
client = &http.Client{ client = &http.Client{
Timeout: time.Hour * 2, Timeout: time.Hour * 12,
Transport: trnspt, Transport: trnspt,
// Disallow any redirect on an HTTP call. This is a security requirement: do not modify // Disallow any redirect on an HTTP call. This is a security requirement: do not modify
// this logic without first ensuring that the new target location IS NOT within the current // this logic without first ensuring that the new target location IS NOT within the current
// instance's local network. // instance's local network.
@@ -191,10 +192,7 @@ func (dl *Download) Execute() error {
req.Header.Set("User-Agent", "Pterodactyl Panel (https://pterodactyl.io)") req.Header.Set("User-Agent", "Pterodactyl Panel (https://pterodactyl.io)")
res, err := client.Do(req) res, err := client.Do(req)
if err != nil { if err != nil {
if IsDownloadError(err) { return ErrDownloadFailed
return err
}
return errors.Wrap(err, ErrDownloadFailed.Error())
} }
defer res.Body.Close() defer res.Body.Close()
if res.StatusCode != http.StatusOK { if res.StatusCode != http.StatusOK {
@@ -337,7 +335,3 @@ func mustParseCIDR(ip string) *net.IPNet {
} }
return block return block
} }
func IsDownloadError(err error) bool {
return errors.Is(err, ErrDownloadFailed) || errors.Is(err, ErrInvalidIPAddress) || errors.Is(err, ErrInternalResolution)
}

View File

@@ -328,15 +328,13 @@ func postServerPullRemoteFile(c *gin.Context) {
download := func() error { download := func() error {
s.Log().WithField("download_id", dl.Identifier).WithField("url", u.String()).Info("starting pull of remote file to disk") s.Log().WithField("download_id", dl.Identifier).WithField("url", u.String()).Info("starting pull of remote file to disk")
if err := dl.Execute(); err != nil { if err := dl.Execute(); err != nil {
if !downloader.IsDownloadError(err) { s.Log().WithField("download_id", dl.Identifier).WithField("error", err).Error("failed to pull remote file")
s.Log().WithField("download_id", dl.Identifier).WithField("error", err).Error("failed to pull remote file")
}
return err return err
} else {
s.Log().WithField("download_id", dl.Identifier).Info("completed pull of remote file")
} }
s.Log().WithField("download_id", dl.Identifier).Info("completed pull of remote file")
return nil return nil
} }
if !data.Foreground { if !data.Foreground {
go func() { go func() {
_ = download() _ = download()
@@ -348,21 +346,6 @@ func postServerPullRemoteFile(c *gin.Context) {
} }
if err := download(); err != nil { if err := download(); err != nil {
if downloader.IsDownloadError(err) {
var message = "The URL or IP address provided could not be resolved to a valid destination."
if errors.Is(err, downloader.ErrDownloadFailed) {
s.Log().WithField("identifier", dl.Identifier).WithField("error", err).Warn("failed to download remote file")
message = "An error was encountered while trying to download this file. Please try again later."
}
c.JSON(http.StatusBadRequest, gin.H{
"identifier": dl.Identifier,
"message": message,
})
return
}
middleware.CaptureAndAbort(c, err) middleware.CaptureAndAbort(c, err)
return return
} }