Skip to content

Conversation

@qgustavor
Copy link
Owner

  1. Fix .downloadId handling
  2. Attempt adding a unit test for that
  3. Realize mega-mock doesn't handle sharing yet and have to skip the test
  4. Fix a warning in the tests by replacing shell: true with cross-spawn

1. Fix .downloadId handling
2. Attempt adding a unit test for that
3. Realize mega-mock doesn't handle sharing yet and have to skip the test
4. Fix a warning in the tests by replacing shell: true with cross-spawn
@qgustavor
Copy link
Owner Author

qgustavor commented Sep 3, 2025

@cyperdark Since I could not test this issue using unit testing, can you checking if this fix looks correct (and, if possible, test it)?

Edit: BTW, I don't mean I didn't test it, but I just tried it with a single test case, which may be prone and, since I wrote it, maybe I have skipped something. I'm human after all (and I don't trust AI to do that).

@cyperdark
Copy link

cyperdark commented Sep 3, 2025

did a small script to compare links in account and on website

  1. looks like decryption key is correct one
  2. file id is different from account one
  3. decryption key for a folder is different
Draw Skin 1.3.osk:
in account
--- https://mega.nz/file/3EYzGJYD#n10rKwpykh31pXZzsp8pNrYGTYp6Sp6uvmxMvBjHdAw
+++ https://mega.nz/file/eFBAAbBA#n10rKwpykh31pXZzsp8pNrYGTYp6Sp6uvmxMvBjHdAw

on website
--- https://mega.nz/folder/jQAQkCba#PdM_L91G4PVLCUx4fPWVrA/file/eFBAAbBA
+++ https://mega.nz/file/eFBAAbBA#n10rKwpykh31pXZzsp8pNrYGTYp6Sp6uvmxMvBjHdAw


Draw Skin 1.3_ultra_lite.osk:
in account
--- https://mega.nz/file/KVYAjB7Z#oqLheFMBn08thwUF7tPSs9W9Ev-6u2dt8gY7hLUWHHY
+++ https://mega.nz/file/zVIADbzK#oqLheFMBn08thwUF7tPSs9W9Ev-6u2dt8gY7hLUWHHY

on website
--- https://mega.nz/folder/jQAQkCba#PdM_L91G4PVLCUx4fPWVrA/file/zVIADbzK
+++ https://mega.nz/file/zVIADbzK#oqLheFMBn08thwUF7tPSs9W9Ev-6u2dt8gY7hLUWHHY


Draw Skin 1.3_extra.zip:
in account
--- https://mega.nz/file/LJw0gYDC#O7nKMQamR14ca3JSaS2k6EXtYDi04xtB3xk8-TdFu-Q
+++ https://mega.nz/file/mBIilB7S#O7nKMQamR14ca3JSaS2k6EXtYDi04xtB3xk8-TdFu-Q

on website
--- https://mega.nz/folder/jQAQkCba#PdM_L91G4PVLCUx4fPWVrA/file/mBIilB7S
+++ https://mega.nz/file/mBIilB7S#O7nKMQamR14ca3JSaS2k6EXtYDi04xtB3xk8-TdFu-Q


folder url
--- https://mega.nz/folder/jQAQkCba#PdM_L91G4PVLCUx4fPWVrA
+++ https://mega.nz/folder/jQAQkCba#0U0BKQQFqJMm0tcNztFopg
import { File } from 'megajs';


const links_in_account: any = {
  'Draw Skin 1.3.osk': 'https://mega.nz/file/3EYzGJYD#n10rKwpykh31pXZzsp8pNrYGTYp6Sp6uvmxMvBjHdAw',
  'Draw Skin 1.3_ultra_lite.osk': 'https://mega.nz/file/KVYAjB7Z#oqLheFMBn08thwUF7tPSs9W9Ev-6u2dt8gY7hLUWHHY',
  'Draw Skin 1.3_extra.zip': 'https://mega.nz/file/LJw0gYDC#O7nKMQamR14ca3JSaS2k6EXtYDi04xtB3xk8-TdFu-Q',
};

const links_on_website: any = {
  'Draw Skin 1.3.osk': 'https://mega.nz/folder/jQAQkCba#PdM_L91G4PVLCUx4fPWVrA/file/eFBAAbBA',
  'Draw Skin 1.3_ultra_lite.osk': 'https://mega.nz/folder/jQAQkCba#PdM_L91G4PVLCUx4fPWVrA/file/zVIADbzK',
  'Draw Skin 1.3_extra.zip': 'https://mega.nz/folder/jQAQkCba#PdM_L91G4PVLCUx4fPWVrA/file/mBIilB7S',
};


async function parse_mega(url: string) {
  try {
    const folder = await File.fromURL(url).loadAttributes();


    const array = folder.children || [];
    console.log('```diff');

    for (let i = 0; i < array.length; i++) {
      const file = array[i];
      console.log(`${file.name}:`);
      console.log('in account');

      console.log('---', links_in_account[file.name!]);
      console.log('+++', await file.link({ key: file.key! }));
      console.log('');

      console.log('on website');

      console.log('---', links_on_website[file.name!]);
      console.log('+++', await file.link({ key: file.key! }));
      console.log('\n');
    };


    console.log('folder url');

    console.log('---', url);
    console.log('+++', await folder.link({ key: folder.key! }));

    console.log('```');
  } catch (error) {
    console.log('mega', error);
  };
};


parse_mega('https://mega.nz/folder/jQAQkCba#PdM_L91G4PVLCUx4fPWVrA');

edit: used local build with pr changes

@qgustavor
Copy link
Owner Author

I guess I have to fix that and implement sharing on mega-mock so we can unit test that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants