gpt4 book ai didi

docker - Google Drive API - 自动查询消息

转载 作者:行者123 更新时间:2023-12-02 11:16:45 25 4
gpt4 key购买 nike

我正在使用 this用于在 Google Drive 上存储图像数据的 Ghost 插件。最近,图像已停止加载,并下载了此错误页面来代替图像:

https://github.com/robincsamuel/ghost-google-drive

该站点在 Google Cloud Run 上的容器化 Ghost 实例中运行,来源 here

我是否需要在某处打开支持票来解决这个问题?有问题的网站是 here

编辑:这是用于访问保存的内容的代码。

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);
}
}
);
});

最佳答案

您的问题与file.downloadUrl有关.此字段不保证有效,不应用于下载文件。

正确的方法是使用 webContentLink属性(property)代替。你可以看看here以供引用。

关于docker - Google Drive API - 自动查询消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60214986/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com