stashapp/stash

[Bug Report] ReadImageFromURL lacks proxy support

Closed this issue · 0 comments

dani commented

Describe the bug
When importing a performer after a successful stashdb lookup for example, a request is made to fetch the corresponding image. But this request lacks outbound proxy support, and fails if direct connection is not allowed.

To Reproduce
Steps to reproduce the behavior:

  1. Setup stash with an oubound proxy, and ensure direct connection is denied
  2. Lookup a scene with stashdb
  3. Try to import a performer
  4. See error

Expected behavior
Request should be made through the proxy, so the performer can be imported

Screenshots
Capture d’écran du 2024-02-28 20-57-28

Stash Version: (from Settings -> About):
0.24.3

Desktop (please complete the following information):

  • OS: Fedora
  • Browser Brave
  • Version 1.63.162

Additional context
The problem is the http client is instancied without proxy config in pkg/utils/image.go -> ReadImageFromURL

    client := &http.Client{
        Transport: &http.Transport{ // ignore insecure certificates
            TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
        },

        Timeout: imageGetTimeout,
    }

I'm not a Go guy, but I guess it just lacks the proxy bit, like

    client := &http.Client{
        Transport: &http.Transport{ // ignore insecure certificates
            TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
            Proxy: http.ProxyFromEnvironment
        },

        Timeout: imageGetTimeout,
    }