mirror of
https://github.com/rclone/rclone.git
synced 2025-01-08 12:34:53 +02:00
mega: fix key decoding - FIXME VENDOR PATCH DO NOT MERGE
See: https://forum.rclone.org/t/problem-to-login-with-mega/12276
This commit is contained in:
parent
ae340cf7d9
commit
aefe18fc41
19
vendor/github.com/t3rm1n4l/go-mega/mega.go
generated
vendored
19
vendor/github.com/t3rm1n4l/go-mega/mega.go
generated
vendored
@ -704,11 +704,20 @@ func (m *Mega) addFSNode(itm FSNode) (*Node, error) {
|
||||
switch {
|
||||
case itm.T == FOLDER || itm.T == FILE:
|
||||
args := strings.Split(itm.Key, ":")
|
||||
if len(args) < 2 {
|
||||
return nil, fmt.Errorf("not enough : in item.Key: %q", itm.Key)
|
||||
}
|
||||
itemUser, itemKey := args[0], args[1]
|
||||
itemKeyParts := strings.Split(itemKey, "/")
|
||||
if len(itemKeyParts) >= 2 {
|
||||
itemKey = itemKeyParts[0]
|
||||
// the other part is maybe a share key handle?
|
||||
}
|
||||
|
||||
switch {
|
||||
// File or folder owned by current user
|
||||
case args[0] == itm.User:
|
||||
buf, err := base64urldecode(args[1])
|
||||
case itemUser == itm.User:
|
||||
buf, err := base64urldecode(itemKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -736,7 +745,7 @@ func (m *Mega) addFSNode(itm FSNode) (*Node, error) {
|
||||
}
|
||||
|
||||
m.FS.skmap[itm.Hash] = itm.SKey
|
||||
buf, err := base64urldecode(args[1])
|
||||
buf, err := base64urldecode(itemKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -750,7 +759,7 @@ func (m *Mega) addFSNode(itm FSNode) (*Node, error) {
|
||||
}
|
||||
// Shared file
|
||||
default:
|
||||
k := m.FS.skmap[args[0]]
|
||||
k := m.FS.skmap[itemUser]
|
||||
b, err := base64urldecode(k)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -763,7 +772,7 @@ func (m *Mega) addFSNode(itm FSNode) (*Node, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
buf, err := base64urldecode(args[1])
|
||||
buf, err := base64urldecode(itemKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user