🐛 S3/WebDAV 数据同步无法使用代理 Fix https://github.com/siyuan-note/siyuan/issues/6695

This commit is contained in:
Liang Ding 2022-11-24 11:00:58 +08:00
parent 255a9c1e01
commit f38e053702
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 27 additions and 3 deletions

View file

@ -20,7 +20,6 @@ import (
"bytes"
"crypto/rand"
"crypto/sha256"
"crypto/tls"
"encoding/base64"
"errors"
"fmt"
@ -824,7 +823,7 @@ func newRepository() (ret *dejavu.Repo, err error) {
case conf.ProviderSiYuan:
cloudRepo = cloud.NewSiYuan(&cloud.BaseCloud{Conf: cloudConf})
case conf.ProviderS3:
s3HTTPClient := &http.Client{Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: cloudConf.S3.SkipTlsVerify}}}
s3HTTPClient := &http.Client{Transport: util.NewTransport(cloudConf.S3.SkipTlsVerify)}
s3HTTPClient.Timeout = 30 * time.Second
cloudRepo = cloud.NewS3(&cloud.BaseCloud{Conf: cloudConf}, s3HTTPClient)
case conf.ProviderWebDAV:
@ -834,7 +833,7 @@ func newRepository() (ret *dejavu.Repo, err error) {
webdavClient.SetHeader("Authorization", auth)
webdavClient.SetHeader("User-Agent", util.UserAgent)
webdavClient.SetTimeout(30 * time.Second)
webdavClient.SetTransport(&http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: cloudConf.WebDAV.SkipTlsVerify}})
webdavClient.SetTransport(util.NewTransport(cloudConf.WebDAV.SkipTlsVerify))
cloudRepo = cloud.NewWebDAV(&cloud.BaseCloud{Conf: cloudConf}, webdavClient)
default:
err = fmt.Errorf("unknown cloud provider [%d]", Conf.Sync.Provider)