ajmal744 / google-api-dotnet-client

Automatically exported from code.google.com/p/google-api-dotnet-client
Apache License 2.0
0 stars 0 forks source link

MediaDownloader can't download Drive ExportList URL #361

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.string url = file.ExportLinks["application/pdf"];
2.downloader.DownloadAsync(url, outStream);
3.occur Null Pointer Exception

What is the expected output? What do you see instead?

download Google Drive's exported file.

What version of the product are you using?

1.4.0 beta

What is your operating system? On what IDE?

Windows8 and Visial Studio 2012

What is the .NET framework version?

.NET for Windows Store app

Please provide any additional information below.

Export PDF url format is :
  https://docs.google.com/feeds/download/spreadsheets/Export?key=${ACCESS_KEY}&exportFormat=pdf

and, I change MediaDownloader.cs line 191, work fine.

var builder = new RequestBuilder() { BaseUri = new Uri(url) };
string query = builder.BaseUri.Query;
if (query != null) {
    if (query.StartsWith("?")) query = query.Substring(1);
    string[] parameters = query.Split('&');
    foreach (string parameter in parameters) {
        string[] entry = parameter.Split('=');
        if (entry.Length != 2) continue;
        builder.AddParameter(RequestParameterType.Query, entry[0], entry[1]);
    }
}

Original issue reported on code.google.com by watt...@gmail.com on 24 Jul 2013 at 11:12

GoogleCodeExporter commented 9 years ago
Bug in media download.
If the user uses a link like 
"https://docs.google.com/feeds/download/spreadsheets/Export?key=${ACCESS_KEY}&ex
portFormat=pdf" while making the media download request the "exportFormat=pdf" 
is deleted from the request. So the request looks like:
"https://docs.google.com/feeds/download/spreadsheets/Export&?alt=media"

We should fix the way we generate a request (MediaDownloader line 192).

Original comment by pele...@google.com on 24 Jul 2013 at 1:36

GoogleCodeExporter commented 9 years ago

Original comment by pele...@google.com on 14 Aug 2013 at 3:24

GoogleCodeExporter commented 9 years ago

Original comment by pele...@google.com on 13 Sep 2013 at 8:57

GoogleCodeExporter commented 9 years ago
https://codereview.appspot.com/13480044/

Original comment by pele...@google.com on 14 Sep 2013 at 1:52

GoogleCodeExporter commented 9 years ago

Original comment by pele...@google.com on 15 Oct 2013 at 4:00