Deleting a project leaves every file uploaded through signed or multipart upload in the bucket

Đang mở
#593 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
next.js, postgresql, typescript
Lĩnh vực
backend, database

Hướng nghiên cứu

Start with lib/projects/purge.ts and compare its project prefix with the object key layouts in the signed upload and multipart upload routes. Then inspect the project deletion tests and add coverage for projects containing one file from each upload path. Done means deleting a project removes both objects, with the tests passing.

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

Mô tả

When a project is deleted, its stored objects are purged by deleting everything under {projectId}/:

https://github.com/backenly/backenly/blob/364c901eee7a1aaf46e3a0a4e5f16217b1b20591/lib/projects/purge.ts#L162-L165

That is where the storage driver puts files ({projectId}/{bucketId}/{fileId}-{hash}{ext}). The two direct-to-S3 upload paths write somewhere else.

Signed upload, projects/{projectId}/buckets/{bucket}/…:

https://github.com/backenly/backenly/blob/364c901eee7a1aaf46e3a0a4e5f16217b1b20591/app/api/v1/%5BprojectId%5D/storage/signed-upload/route.ts#L166

S3 multipart upload, projects/{projectId}/buckets/{bucket}/{uploadId}/…:

https://github.com/backenly/backenly/blob/364c901eee7a1aaf46e3a0a4e5f16217b1b20591/app/api/v1/%5BprojectId%5D/storage/upload-multipart/route.ts#L113

So after a project is deleted, every file its end users uploaded through those paths (large uploads such as videos, which is what those paths are for) stays in the bucket with no row pointing at it. The storage sweep could catch these objects, but it only deletes when BACKENLY_STORAGE_PURGE=enforce, and the default is a dry run:

https://github.com/backenly/backenly/blob/364c901eee7a1aaf46e3a0a4e5f16217b1b20591/lib/storage/storage-lifecycle.ts#L609-L618

For a developer, "delete project" does not delete their users' files. That matters for their users' deletion requests as much as for cost.

Done when deleting a project removes objects under both layouts (or the upload paths use the driver's layout), with a test that deletes a project holding a signed-upload file and a multipart file.

Ngôn ngữ chính
TypeScript
Star
56
Fork
19
Merge trung bình
14 giờ 4 phút
Pull request đã merge (30 ngày)
366

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của backenly/backenly

Tất cả issue của backenly/backenly

Issue tương tự

Thêm issue về TypeScript

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.