Bes*_*nna 7 google-drive-api docker ghost-blog google-cloud-run
我正在使用这个Ghost 插件在 Google Drive 上存储图像数据。最近,图像已停止加载,并下载了此错误页面来代替图像:
该站点在 Google Cloud Run 上的容器化 Ghost 实例中运行,来源在这里
我是否需要在某处打开支持票来解决这个问题?有问题的网站在这里
编辑:这是用于访问保存的内容的代码。
jwtClient.authorize(function(err, tokens) {
if (err) {
return next(err);
}
const drive = google.drive({
version: API_VERSION,
auth: jwtClient
});
drive.files.get(
{
fileId: id
},
function(err, response) {
if (!err) {
const file = response.data;
const newReq = https
.request(
file.downloadUrl + "&access_token=" + tokens.access_token,
function(newRes) {
// Modify google headers here to cache!
const headers = newRes.headers;
headers["content-disposition"] =
"attachment; filename=" + file.originalFilename;
headers["cache-control"] = "public, max-age=1209600";
delete headers["expires"];
res.writeHead(newRes.statusCode, headers);
// pipe the file
newRes.pipe(res);
}
)
.on("error", function(err) {
console.log(err);
res.statusCode = 500;
res.end();
});
req.pipe(newReq);
} else {
next(err);
}
}
);
});
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
222 次 |
最近记录: |