1
0
mirror of https://github.com/rclone/rclone.git synced 2026-01-24 13:23:14 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
necaran
e44829a448 mega: reverts TLS workaround
The workaround to include the obsolete cipher suite is no longer needed because storage endpoints now support TLS1.3.
2026-01-24 12:35:02 +00:00
3 changed files with 5 additions and 29 deletions

View File

@@ -17,12 +17,10 @@ Improvements:
import (
"context"
"crypto/tls"
"encoding/base64"
"errors"
"fmt"
"io"
"net/http"
"path"
"slices"
"strings"
@@ -256,25 +254,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
defer megaCacheMu.Unlock()
srv := megaCache[opt.User]
if srv == nil {
// srv = mega.New().SetClient(fshttp.NewClient(ctx))
// Workaround for Mega's use of insecure cipher suites which are no longer supported by default since Go 1.22.
// Relevant issues:
// https://github.com/rclone/rclone/issues/8565
// https://github.com/meganz/webclient/issues/103
clt := fshttp.NewClient(ctx)
clt.Transport = fshttp.NewTransportCustom(ctx, func(t *http.Transport) {
var ids []uint16
// Read default ciphers
for _, cs := range tls.CipherSuites() {
ids = append(ids, cs.ID)
}
// Insecure but Mega uses TLS_RSA_WITH_AES_128_GCM_SHA256 for storage endpoints
// (e.g. https://gfs302n114.userstorage.mega.co.nz) as of June 18, 2025.
t.TLSClientConfig.CipherSuites = append(ids, tls.TLS_RSA_WITH_AES_128_GCM_SHA256)
})
srv = mega.New().SetClient(clt)
srv = mega.New().SetClient(fshttp.NewClient(ctx))
srv.SetRetries(ci.LowLevelRetries) // let mega do the low level retries
srv.SetHTTPS(opt.UseHTTPS)
srv.SetLogger(func(format string, v ...any) {

View File

@@ -15,7 +15,6 @@ import (
"time"
"github.com/rclone/rclone/fs"
"github.com/rclone/rclone/lib/errcount"
"golang.org/x/sync/errgroup"
"golang.org/x/text/unicode/norm"
)
@@ -627,7 +626,6 @@ func (f *Filter) MakeListR(ctx context.Context, NewObject func(ctx context.Conte
remotes = make(chan string, checkers)
g, gCtx = errgroup.WithContext(ctx)
)
ec := errcount.New()
for range checkers {
g.Go(func() (err error) {
var entries = make(fs.DirEntries, 1)
@@ -636,8 +634,7 @@ func (f *Filter) MakeListR(ctx context.Context, NewObject func(ctx context.Conte
if err == fs.ErrorObjectNotFound {
// Skip files that are not found
} else if err != nil {
fs.Errorf(remote, "--files-from failed to find file: %v", err)
ec.Add(err)
return err
} else {
err = callback(entries)
if err != nil {
@@ -657,8 +654,7 @@ func (f *Filter) MakeListR(ctx context.Context, NewObject func(ctx context.Conte
}
}
close(remotes)
ec.Add(g.Wait())
return ec.Err("failed to read --files-from files")
return g.Wait()
}
}

View File

@@ -394,7 +394,7 @@ func TestNewFilterMakeListR(t *testing.T) {
// Now check an error is returned from NewObject
require.NoError(t, f.AddFile("error"))
err = listR(context.Background(), "", listRcallback)
require.EqualError(t, err, "failed to read --files-from files: assert.AnError general error for testing")
require.EqualError(t, err, assert.AnError.Error())
// The checker will exit by the error above
ci := fs.GetConfig(context.Background())
@@ -403,7 +403,7 @@ func TestNewFilterMakeListR(t *testing.T) {
// Now check an error is returned from NewObject
require.NoError(t, f.AddFile("error"))
err = listR(context.Background(), "", listRcallback)
require.EqualError(t, err, "failed to read --files-from files: assert.AnError general error for testing")
require.EqualError(t, err, assert.AnError.Error())
}
func TestNewFilterMinSize(t *testing.T) {