MegaFS icon indicating copy to clipboard operation
MegaFS copied to clipboard

Issue with shared folder

Open kionez opened this issue 12 years ago • 2 comments

Hi,

I'm playing with your python library, and I wasn't able to use it for my purposes. After some time of try-and-error, I discovered how it's handled a shared folder, instead of "classsic" way to concatenate chunks such as {k: foo:bar} when it founds a folder shared with someone else, it concatenates as {k: foo1:bar1/foo2:bar2 }.

So i wrote a small patch which keeps only the first part of key chunk, and now it works fine on my account.

I hope it helps and please forgive my poor english :)

1: https://eu.static.mega.co.nz/crypto_5.js

--- megaclient.py.orig  2013-02-05 00:44:35.265816237 +0100
+++ megaclient.py   2013-02-05 00:45:05.589558279 +0100
@@ -57,7 +57,8 @@

     def processfile(self, file):
         if file['t'] == 0 or file['t'] == 1:
-            key = file['k'][file['k'].index(':') + 1:]
+            obj = file['k'].split('/')[0]
+            key = obj[obj.index(':') + 1:]
             key = decrypt_key(base64_to_a32(key), self.master_key)
             if file['t'] == 0:
                 k = file['k'] = (key[0] ^ key[4], key[1] ^ key[5], key[2] ^ key[6], key[3] ^ key[7])

kionez avatar Feb 05 '13 00:02 kionez

I added mkdir() code submited by ProlyX's comment on your blog [1] and changed key splitting method with one more clever, now I'm working to find way to add move, delete (wich is simply a move-to-trash) and empty Rubbish bin.

so, here's the small patch: http://pastebin.com/hR1etvLd

1: http://pastebin.com/BF2uFY0y

kionez avatar Feb 05 '13 21:02 kionez

I'am not into that so thanks for creating the patch...

i started with unlink, basicly it works (currently without clearing the Rubbish Bin [so unlink is basicly moveto]) but you may start with that: http://pastebin.com/p4gP59ie

(Prolyx)

MWent avatar Feb 05 '13 21:02 MWent