Problem using Google Apps Viewer to view a blob

2,543 views
Skip to first unread message

Joshua Smith

unread,
Jul 19, 2011, 7:55:49 PM7/19/11
to google-a...@googlegroups.com
If you look at this URL:

http://www.mytowngovernment.org/meeting/1234040

and click the link for one of the .doc files, they work in google's viewer. But if you click on one of the .docx files, they don't.

When you click on the link to view, it does this:

dlurl=re.sub('viewer','download',self.request.uri)
self.redirect("http://docs.google.com/viewer?url=%s" % urllib.quote(dlurl))

and the download handler is simply:

documentKey = self.request.get("document")
document = DocumentModel.get(documentKey)
self.send_blob(document.blob.key())

Everything I've read says that google's docs viewer should be able to view .docx files, so I'm guessing the problem is in the way the blob is served from GAE to Google Apps.

Any ideas?

-Joshua

Nick Johnson (Google)

unread,
Jul 19, 2011, 11:59:18 PM7/19/11
to google-a...@googlegroups.com
Have you checked what Mime-Type you're serving the documents as, and if it's valid for docx documents?

-Nick Johnson


--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.




--
Nick Johnson, Developer Programs Engineer, App Engine


Joshua Smith

unread,
Jul 20, 2011, 12:08:23 PM7/20/11
to google-a...@googlegroups.com
Excellent question. No, I hadn't.

I just added this:

    self.response.headers['Content-Type'] = str(mimetypes.guess_type(document.title)[0]) or 'application/octet-stream'

and the headers now say:

HTTP/1.1 200 OK
Cache-Control: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Date: Wed, 20 Jul 2011 16:06:14 GMT
Server: Google Frontend
Content-Length: 10762

But there is no change.  .doc files still work, and .docx files do not.

Any other ideas?

-Joshua

Nick Johnson (Google)

unread,
Jul 25, 2011, 2:21:56 AM7/25/11
to google-a...@googlegroups.com
On Thu, Jul 21, 2011 at 2:08 AM, Joshua Smith <Joshua...@charter.net> wrote:
Excellent question. No, I hadn't.

I just added this:

    self.response.headers['Content-Type'] = str(mimetypes.guess_type(document.title)[0]) or 'application/octet-stream'

and the headers now say:

HTTP/1.1 200 OK
Cache-Control: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Date: Wed, 20 Jul 2011 16:06:14 GMT
Server: Google Frontend
Content-Length: 10762

But there is no change.  .doc files still work, and .docx files do not.

Determine the actual mimetype that docx files should be served as, and make sure you're serving as that. Don't expect the mimetype module to know.

-Nick

Joshua Smith

unread,
Jul 26, 2011, 11:33:37 AM7/26/11
to google-a...@googlegroups.com
Well all my googling turns up that the mimetype module is giving the best answer (see attached pic)
and I certainly cannot find any *other* mime type to use for docx files.

Do you suppose you could send a note over to someone on the google apps team and find out from them what mime type will let me use the google apps viewer for docx files?

-Joshua

chrsnv

unread,
Sep 9, 2011, 9:20:04 AM9/9/11
to Google App Engine
I also encoutered the same problem witch .docx files. When open
a .docx file in Google viewer it display nothing....Is this a bug of
the Google viewer?

On 26 jul, 17:33, Joshua Smith <JoshuaESm...@charter.net> wrote:
> Well all my googling turns up that the mimetype module is giving the best answer (see attached pic)
>
> and I certainly cannot find any *other* mime type to use for docx files.
>
> Do you suppose you could send a note over to someone on the google apps team and find out from them what mime type will let me use the google apps viewer for docx files?
>
> -Joshua
>
> On Jul 25, 2011, at 2:21 AM, Nick Johnson (Google) wrote:
>
>
>
>
>
>
>
> > On Thu, Jul 21, 2011 at 2:08 AM, Joshua Smith <JoshuaESm...@charter.net> wrote:
> > Excellent question. No, I hadn't.
>
> > I just added this:
>
> >     self.response.headers['Content-Type'] = str(mimetypes.guess_type(document.title)[0]) or 'application/octet-stream'
>
> > and the headers now say:
>
> > HTTP/1.1 200 OK
> > Cache-Control: no-cache
> > Expires: Fri, 01 Jan 1990 00:00:00 GMT
> > Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
> > Date: Wed, 20 Jul 2011 16:06:14 GMT
> > Server: Google Frontend
> > Content-Length: 10762
>
> > But there is no change.  .doc files still work, and .docx files do not.
>
> > Determine the actual mimetype that docx files should be served as, and make sure you're serving as that. Don't expect the mimetype module to know.
>
> > -Nick
>
> > Any other ideas?
>
> > -Joshua
>
> > On Jul 19, 2011, at 11:59 PM, Nick Johnson (Google) wrote:
>
> >> Have you checked what Mime-Type you're serving the documents as, and if it's valid for docx documents?
>
> >> -Nick Johnson
>
> >> On Wed, Jul 20, 2011 at 9:55 AM, Joshua Smith <JoshuaESm...@charter.net> wrote:
> >> If you look at this URL:
>
> >>http://www.mytowngovernment.org/meeting/1234040
>
> >> and click the link for one of the .doc files, they work in google's viewer.  But if you click on one of the .docx files, they don't.
>
> >> When you click on the link to view, it does this:
>
> >>   dlurl=re.sub('viewer','download',self.request.uri)
> >>   self.redirect("http://docs.google.com/viewer?url=%s" % urllib.quote(dlurl))
>
> >> and the download handler is simply:
>
> >>   documentKey = self.request.get("document")
> >>   document = DocumentModel.get(documentKey)
> >>   self.send_blob(document.blob.key())
>
> >> Everything I've read says that google's docs viewer should be able to view .docx files, so I'm guessing the problem is in the way the blob is served from GAE to Google Apps.
>
> >> Any ideas?
>
> >> -Joshua
>
> >> --
> >> You received this message because you are subscribed to the Google Groups "Google App Engine" group.
> >> To post to this group, send email to google-a...@googlegroups.com.
> >> To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
> >> For more options, visit this group athttp://groups.google.com/group/google-appengine?hl=en.
>
> >> --
> >> Nick Johnson, Developer Programs Engineer, App Engine
>
> >> --
> >> You received this message because you are subscribed to the Google Groups "Google App Engine" group.
> >> To post to this group, send email to google-a...@googlegroups.com.
> >> To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
> >> For more options, visit this group athttp://groups.google.com/group/google-appengine?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups "Google App Engine" group.
> > To post to this group, send email to google-a...@googlegroups.com.
> > To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/google-appengine?hl=en.

Joshua Smith

unread,
Sep 9, 2011, 4:05:20 PM9/9/11
to google-a...@googlegroups.com, Gregory D'alesandre
I've never heard anything more on this. Hey Gred D', can you do us a solid and forward this question over to the google apps people responsible for the "viewer"?

Hideki (Wyse)

unread,
Sep 12, 2011, 2:19:26 PM9/12/11
to Google App Engine
Hi,

I have encountered similar problem. In case of opening the .xls (MS
Excel) or .ppt (MS PowerPoint) files which are served from BlobStore
in Google Doc Viewer, Google Doc Viewer can not display them. Error
message from Google Doc Viewer is "Sorry, we are unable to generate a
view of the document at this time.".

However, .doc (MS Word) and .pdf (PDF) files are worked fine. In
addition, .xls and .ppt files are displayed fine when they are served
as static files (not from BlobStore) like image or CSS files.


The application set "application/vnd.ms-powerpoint" for Content-Type
of PPT file.

------- Http Header information for PPT file ----------------
< HTTP/1.1 200 OK
< accept-ranges: bytes
< Content-Type: application/vnd.ms-powerpoint
< Content-Disposition: attachment; filename="abc.ppt"
< Date: Mon, 12 Sep 2011 18:13:58 GMT
< Server: Google Frontend
< Content-Length: 102912
----------------------------------------------------------------------------

Are there anything I can try?

Any information is appreciated.

Thanks,
Hideki
Reply all
Reply to author
Forward
0 new messages