update
This commit is contained in:
@@ -39,6 +39,14 @@ export const s3Proxy = async (req: http.IncomingMessage, res: http.ServerRespons
|
||||
if (objectPath.startsWith(s3.bucket + '/')) {
|
||||
objectPath = objectPath.replace(s3.bucket + '/', '');
|
||||
}
|
||||
if (objectPath.endsWith('/')) {
|
||||
// 获取目录列表
|
||||
res.statusCode = 200;
|
||||
res.setHeader('Content-Type', 'application/json; charset=utf-8');
|
||||
const list = await oss.listObjects(objectPath);
|
||||
res.end(JSON.stringify(list, null, 2));
|
||||
return;
|
||||
}
|
||||
oss.getObject(objectPath).then((response) => {
|
||||
if (!response.Body) {
|
||||
res.statusCode = 404;
|
||||
|
||||
Reference in New Issue
Block a user