Skip to content

Commit dfa6a29

Browse files
committed
Fix: large file handle unproperly
Signed-off-by: YouXam <[email protected]>
1 parent ea6ccbc commit dfa6a29

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/api/file.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,14 @@ export default new Hono<{
5757
})
5858

5959
if (check.length) {
60+
console.error("文件状态不正确", check)
6061
return c.json({
6162
error: "文件状态不正确",
6263
success: false,
6364
files: check
6465
})
6566
}
66-
67+
console.log("Publishing", ids)
6768
await prisma.file.updateMany({
6869
where: {
6970
id: {
@@ -118,7 +119,7 @@ export default new Hono<{
118119
if (responses.some(r => r.status === "rejected")) {
119120
return c.json({
120121
success: false,
121-
error: "部分文件删除失败",
122+
error: "部分标签删除失败",
122123
responses
123124
})
124125
}

src/api/s3.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default new Hono<{
4444
}>
4545
}
4646
console.log("BODY:" + JSON.stringify(body))
47-
if (body.EventName !== "s3:ObjectCreated:Put") {
47+
if (body.EventName !== "s3:ObjectCreated:Put" && body.EventName !== "s3:ObjectCreated:CompleteMultipartUpload") {
4848
return c.json({ success: true })
4949
}
5050
const prisma = new PrismaClient({ adapter: new PrismaD1(c.env.DB) })
@@ -88,10 +88,6 @@ export default new Hono<{
8888
await setError("文件大小超过 2G")
8989
continue
9090
}
91-
if (!record.s3.object.key.startsWith(record.s3.object.eTag)) {
92-
await setError("文件内容 md5 和文件名不匹配")
93-
continue
94-
}
9591

9692
await c.get("s3").fetch(`${c.env.S3_HOST}/${c.env.S3_BUCKET}/${record.s3.object.key}?tagging`, {
9793
method: "PUT",

0 commit comments

Comments
 (0)