Ebeo / google-gdata

Automatically exported from code.google.com/p/google-gdata
0 stars 0 forks source link

DocumentsRequest Download fails for spreadsheets #348

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Download a spreadsheet using DocumentsRequest.Download method on the
latest build from the SVN.

What is the expected output? What do you see instead?
Should return the Stream, instead you get a File Not Found error.

What version of the product are you using? On what operating system?
v1.5.0 v3.0 API

Please provide any additional information below.
Currently using DocumentsService.Query with the
Document.DocumentEntry.Content.Src works as a work-around.

Original issue reported on code.google.com by testacco...@gmail.com on 2 Mar 2010 at 10:55

GoogleCodeExporter commented 9 years ago
we are having a similar issue with using the newer API using a Apps Premiere 
account.

When we try to call the DocumentsRequest.Download method the following error is 
thrown:
Invalid URI: The format of the URI could not be determined.

In the debug log it shows the following:
[08:38:22:6668] - Returned contenttype is: text/html; charset=UTF-8 from URI : 
http://spreadsheets.google.com/feeds/download/spreadsheets/Export?
key=spreadsheet:0AjM9yrlWUZOYdEN1c0UzbHdPMWdNX2w4UnhHZVdfZ1E&exportFormat=xls
[08:38:22:6668] - Returned statuscode is: Found302
[08:38:22:6678] - throwing for redirect
[08:38:22:6738] - Got a redirect to: /feeds/download/spreadsheets/Export?
key=0AjM9yrlWUZOYdEN1c0UzbHdPMWdNX2w4UnhHZVdfZ1E&exportFormat=xls

So it redirects to a new url... but nothing comes back. Pasting this url in the 
browser returns nothing as well.

Original comment by cpax...@gmail.com on 24 Mar 2010 at 1:55

GoogleCodeExporter commented 9 years ago
I was able to track it down to line 604 in gauthrequest.cs
this.TargetUri = new Uri(re.Location);

The redirect location does not contain the host name and can't beresolved.

I changed it to:
this.TargetUri = new Uri(@"http://spreadsheets.google.com" + re.Location);

This is more of a hack since it would only work for the spreadsheet service

Original comment by cpax...@gmail.com on 24 Mar 2010 at 2:31

GoogleCodeExporter commented 9 years ago
That's a bug in the service, this redirect location header is invalid. I will 
notify
the service team.

Frank

Original comment by fman...@gmail.com on 7 Apr 2010 at 6:43

GoogleCodeExporter commented 9 years ago
Service team notified. 

Original comment by fman...@gmail.com on 7 Apr 2010 at 3:56

GoogleCodeExporter commented 9 years ago
When can u fix that?:P

Original comment by Shawn198...@gmail.com on 20 May 2010 at 3:07

GoogleCodeExporter commented 9 years ago
I can not fix that. Only the Spreadsheet service team can fix that. And they 
know about the bug. You might want 
to create a public service bug as well.

Frank Mantek
Google

Original comment by fman...@gmail.com on 20 May 2010 at 6:38

GoogleCodeExporter commented 9 years ago
Not that uncommon to have a 'relative' redirects I would have thought.
Could be relatively easily handled generically by something along the lines of
                if (re.Location.StartsWith("/"))
                {   // must be a relative redirect so we need to rebuild to apply 
authority
                    string stemp = this.TargetUri.GetLeftPart(UriPartial.Authority);
                    stemp += re.Location;
                    this.TargetUri = new Uri(stemp);
                }
                else
                    this.TargetUri = new Uri(re.Location); 

Original comment by cnwj...@gmail.com on 3 Jun 2010 at 3:35

GoogleCodeExporter commented 9 years ago
According to the HTTP protocol spec, the Location header must contain an 
absolute 
URI[5].

Yes I might be able to work around it, of course. But it's a security issue to 
do so, 
which is why most browsers display a warning (per wikipedia at least) if that 
is 
happening. I can't really popup UI in a library, can i :) 

Original comment by fman...@gmail.com on 7 Jun 2010 at 2:50

GoogleCodeExporter commented 9 years ago
Me facing the same problem too. Using the same method, only can export 
Documents and Presentation files, not Spreadsheet. Return Invalid URI error.

Currently using version 1.6, but still facing same problem as v1.5. Any 
workaround? Or how long it needs to fix?

Thanks.

Original comment by v.han...@gmail.com on 24 Jun 2010 at 8:27

GoogleCodeExporter commented 9 years ago
@Frank, have you created a public issue at 
http://code.google.com/p/gdata-issues/issues  ?  I can't find it....
fabrizio

Original comment by fht...@gmail.com on 11 Jul 2010 at 3:28

GoogleCodeExporter commented 9 years ago
Is there a work around available? Or do you know another method to download 
SpreadSheets?

Original comment by pieter....@gmail.com on 12 Sep 2010 at 9:16

GoogleCodeExporter commented 9 years ago
Hey, I was able to fix it by adding this to line 711 of docrequest.cs:

queryUri = queryUri.Replace("spreadsheet:", "");

Looks like it prepends the key with "spreadsheet:" which causes the uri to be 
invalid.

Original comment by VTSc...@gmail.com on 24 Sep 2010 at 7:34

GoogleCodeExporter commented 9 years ago
VTSCott,

I have another issue opened up:  
http://code.google.com/p/google-gdata/issues/detail?id=411   .  It should fix 
your problem.  The request is making the url from scratch, instead of getting 
it from the Doc List.

Can you guys start the issue?

Original comment by ed...@edwinlandy.com on 24 Sep 2010 at 1:20

GoogleCodeExporter commented 9 years ago
Issue 400 has been merged into this issue.

Original comment by ccherub...@google.com on 8 Nov 2010 at 4:22

GoogleCodeExporter commented 9 years ago

Original comment by ccherub...@google.com on 18 Mar 2011 at 1:41

GoogleCodeExporter commented 9 years ago
Please close this issue.

Original comment by andrew.f...@gmail.com on 4 Sep 2012 at 1:38

GoogleCodeExporter commented 9 years ago

Original comment by ccherub...@google.com on 4 Sep 2012 at 4:21