Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Undecrypted Files' if files are uploaded after getting folder download link #221

Open
adeyblue opened this issue Dec 25, 2022 · 1 comment

Comments

@adeyblue
Copy link

Description:

Uploading files to a folder after getting it's download link makes them inaccessible using the download link

Actual Behavior:

The files in the folder are listed as 'undecrypted file' and can't be accessed

Expected Behavior:

The files are accessible

Steps to Reproduce:

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using CG.Web.MegaApiClient;

namespace App
{
    class Program
    {
        static void Main()
        {
            MegaApiClient client = new MegaApiClient();
            client.Login("...", "...");
            IEnumerable<INode> nodes = client.GetNodes();
            INode rootNode = null;
            foreach (INode node in nodes)
            {
                if (node.Type == NodeType.Root)
                {
                    rootNode = node;
                    break;
                }
            }
            INode folder1 = client.CreateFolder("folder1", rootNode);
            string link = client.GetDownloadLink(folder1).AbsoluteUri;
            for (int i = 1; i <= 3; ++i)
            {
                string file = String.Format("File{0}.txt", i);
                using (MemoryStream str = new MemoryStream(Encoding.UTF8.GetBytes(file)))
                {
                    INode fileNode = client.Upload(str, file, folder1);
                    Console.WriteLine("Uploaded {0} as mega id {1}, fileData is {2}/{3} bytes", file, fileNode.Id, file.Length, fileNode.Size);
                }
            }
            Console.WriteLine("Uploaded to folder {0}", link);
        }
    }
}

Accessing the folder link shows undecrypted files. You can access them by loggng in to the Mega site, but not by visiting the folder link in a browser.
This doesn't happen using Mega's site if you create a folder, get a link, then upload files to that folder

MegaApiClient Version:
1.10.3

@gpailler
Copy link
Owner

gpailler commented Jan 9, 2023

Hello

It's a known limitation and I actually don't know how it can be fixed.
The workaround is to call GetDownloadLink() after the uploads to have all the files accessible

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

No branches or pull requests

3 participants
@gpailler @adeyblue and others