Comments (4)
Hello,
I'm not able to reproduce the issue you described with the following test
[Theory]
[InlineData("https://mega.nz/file/B7BnxarD#pt_9ebHpGvzCi3LBVVfBcudIys7mZGma_wHHquWTEkE")]
public async void GetNodeFromLinkAsync_Succeeds(string fileLink)
{
var instance = new MegaApiClient();
await instance.LoginAnonymousAsync();
var node = await instance.GetNodeFromLinkAsync(new Uri(fileLink));
Assert.NotNull(node);
Assert.Equal("fm.png", node.Name);
Assert.Equal(597194, node. Size);
}
Could you provide a small sample?
from megaapiclient.
It happens when querying a just created folder now. The created folder shows up as 'undecrypted folder' in the web file manager
using System;
using System.Collections.Generic;
using CG.Web.MegaApiClient;
namespace ConsoleApp1
{
class Program
{
static INode GetRootNode(MegaApiClient client)
{
IEnumerable<INode> newNodes = client.GetNodes();
INode rootNode = null;
foreach (INode node in newNodes)
{
if (node.Type == NodeType.Root)
{
rootNode = node;
break;
}
}
return rootNode;
}
static void Main(string[] args)
{
MegaApiClient client = new MegaApiClient();
try
{
MegaApiClient.LogonSessionToken token = client.Login("email", "pass");
Console.WriteLine("Logged in on session {0}", token.SessionId);
INode rootNode = GetRootNode(client);
string upFile = args[0];
INode testFolder = client.CreateFolder("testFolder", rootNode);
Console.WriteLine("Created {0}, type {1}, size {2}, id {3}", testFolder.Name, testFolder.Type, testFolder.Size, testFolder.Id);
Console.WriteLine("Getting link");
Uri link = client.GetDownloadLink(testFolder);
Console.WriteLine("Got link {0}", link);
INode newFolderNode = client.GetNodeFromLink(link);
Console.WriteLine("Got node {0}, type {1}, size {2}, id {3}", newFolderNode.Name, newFolderNode.Type, newFolderNode.Size, newFolderNode.Id);
}
catch(Exception e)
{
Console.WriteLine("Caught exception type {0}: ({1}){2}{3}", e.GetType().Name, e.Message, Environment.NewLine, e.StackTrace);
}
client.Logout();
}
}
}
Logged in on session f_vJfH_...
Created testFolder, type Directory, size 0, id P9xj2CDZ
Getting link
Got link https://mega.nz/folder/bt5gGCSS#NNIYUaTjxQom2jvgzJgGeA
Caught exception type ApiException: (API response: AccessDenied)
at CG.Web.MegaApiClient.MegaApiClient.RequestCore[TResponse](RequestBase request, Byte[] key) in //MegaApiClient/MegaApiClient.cs:line 1136
at CG.Web.MegaApiClient.MegaApiClient.Request[TResponse](RequestBase request, Byte[] key) in //MegaApiClient/MegaApiClient.cs:line 1092
at CG.Web.MegaApiClient.MegaApiClient.GetNodeFromLink(Uri uri) in /_/MegaApiClient/MegaApiClient.cs:line 672
at ConsoleApp1.Program.Main(String[] args) in T:\nettest\ConsoleApp1\Program.cs:line 38
from megaapiclient.
The link references a folder so you should use GetNodeSFromLink() method instead.
I will update the library to throw a meaningful exception when GetNode(s)FromLink are called with incorrect url
from megaapiclient.
Thanks, still having problems though.
This code with this link
https://mega.nz/folder/L1xlRRAL#I5Lq0N5aUBT4dyLgp0QPFg
shows
Logged in on session Saz...
Got node Attribute deserialization failed: Unexpected character encountered while parsing value: ?. Path '', line 0, position 0., type Root, size 0, id O8AWGJBaGot node Attribute deserialization failed: Unexpected character encountered while parsing value: (. Path '', line 0, position 0., type File, size 507568, id 68BWELLS
Both the file and folder are named AMlNVS0u1Co0STJw0CrOyHBTSMtLUcvPLHDML1fwVE9LUVYsMFUwydNNSwgoSAIL.
Trying to access the link via web browser shows 'Invalid decryption key' but that's the link that was generated by GetDownloadLink and is the one Mega shows.
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Text;
using CG.Web.MegaApiClient;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
MegaApiClient client = new MegaApiClient();
try
{
MegaApiClient.LogonSessionToken token = client.Login("mail", "pass");
Console.WriteLine("Logged in on session {0}", token.SessionId);
Uri link = new Uri(args[0]);
IEnumerable<INode> newFolderNodes = client.GetNodesFromLink(link);
foreach (INode dlNode in newFolderNodes)
{
Console.WriteLine("Got node {0}, type {1}, size {2}, id {3}", dlNode.Name, dlNode.Type, dlNode.Size, dlNode.Id);
}
}
catch(Exception e)
{
Console.WriteLine("Caught exception type {0}: ({1}){2}{3}", e.GetType().Name, e.Message, Environment.NewLine, e.StackTrace);
}
client.Logout();
}
}
}
from megaapiclient.
Related Issues (20)
- Problem accessing MEGA API account HOT 3
- Add ability to attach thumbnails to image uploads HOT 1
- Possible To Get Progress On Get Nodes HOT 1
- Add sample to show how to retrieve folder contents recursively from parent folder
- How can I implement functions to collect more metadata?
- Unable to get download link for directory node HOT 2
- Contacts and shared folders support? Usage of owner IDs? Errors with attribute deserialization! HOT 1
- Resolving MEGA Account Blocking Issue When Uploading Files HOT 2
- MegaApiClient error when building Console App to native code HOT 1
- CG.Web.MegaApiClient.MegaApiClient.Login > Unable to cast object of type 'System.Int64' to type 'Newtonsoft.Json.Linq.JArray' HOT 3
- Problem with LoginAnonymous()
- What is the difference between `Task.Delay(retryDelay).Wait()` and `Thread.Sleep(retryDelay)` HOT 3
- Unable to load nodes due to too much memory consumption. HOT 4
- Attribute deserialization failed: Unexpected character encountered while parsing value: HOT 1
- Not returning new created folders HOT 4
- MegaApiClient is now in passive maintenance mode HOT 1
- Name is coming as NULL for files uploaded using 'CreateFileRequest'
- Erro DeleteAsync HOT 1
- GetDownloadLink not working. No option to get the share link. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from megaapiclient.