Google云端硬盘Web视图返回错误的内容类型

时间:2012-11-29 13:01:10

标签: google-drive-api

Google云端硬盘应该能够根据此博文提供html:http://googleappsdeveloper.blogspot.nl/2012/11/announcing-google-drive-site-publishing.html

但是在我的帐户中,我只是在<pre></pre>之间获取了我的HTML代码。

我使用测试html文件创建了一个测试文件夹:https://googledrive.com/host/0BxVNvXP_dI5QTEstTEtmMXNkOFU/

html文件的内容:

<html>
<head>
    <title>Test 123</title>
</head>
<body>
    Test 123.
</body>
</html>

博客文章中的example具有以下HTTP响应标头:

HTTP/1.1 200 OK
status: 200 OK
version: HTTP/1.1
cache-control: private, max-age=315360000
content-length: 1724
content-type: text/html
date: Thu, 29 Nov 2012 12:55:22 GMT
last-modified: Tue, 06 Nov 2012 23:57:41 GMT
server: HTTP Upload Server Built on Nov 21 2012 16:10:52 (1353543052)

我的页面有以下HTTP响应标头:

HTTP/1.1 200 OK
status: 200 OK
version: HTTP/1.1
cache-control: private, max-age=315360000
content-length: 96
content-type: text/plain
date: Thu, 29 Nov 2012 12:51:00 GMT
last-modified: Thu, 29 Nov 2012 12:50:28 GMT
server: HTTP Upload Server Built on Nov 21 2012 16:10:52 (1353543052)

因此,差异是content-type标题。不知怎的,我需要告诉Google Drive我的html确实是一个HTML。文件。

1 个答案:

答案 0 :(得分:3)

文件的MIME类型是在上传时设置的。您是否可以使用.txt扩展名上传文件并重命名?如果您删除并重新上传HTML文件,我敢打赌它会起作用。

相关问题