CodeGenieApp / CodeGenieApp/serverless-express

both express.static and res.sendFile return wrong binary when serving a zip file

Đang mở
#677 2 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
5.3k
Fork
674
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I'm not using any middleware except express.json and cors.

this is lambda.ts

```
import serverlessExpress from "@codegenie/serverless-express";
import app from "./app";
exports.handler = serverlessExpress({
app,
binaryMimeTypes: ["application/x-zip", "application/zip"],
});
```

I tried with and without specifying `binaryMimeTypes` and with and without the specific first route:

```ts
app.use("/done/ext.zip", (req, res) => {
res.sendFile(path.join(__dirname, "public/ext.zip"));
});
app.use("/done", express.static("public"));
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với lambda.ts và app, sau đó tái hiện route /done/ext.zip res.sendFile và route /done express.static bằng các cài đặt binaryMimeTypes được nêu. So sánh các byte zip được trả về với public/ext.zip trong môi trường Lambda; hoàn tất khi cả hai route đều trả về một tệp zip hợp lệ, không bị hỏng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
aws, express, javascript, node.js, typescript
Lĩnh vực
api, backend, cloud
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
30/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.