Allow `createObjectURL` to retain filename from `File` (and similar) objects
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- HTML
- Star
- 118
- Fork
- 52
- Merge trung bình
- 9 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 1
Mô tả
What problem are you trying to solve?
We have a datastore that requires authentication to retrieve files (e.g. PDF, CSV, ZIP, PNG, or some Office suite file format) -- it has a file name, a content type, and data. We'd like to allow users to click a link (or button/...) and have the "file" corresponding to that data (which we currently retrieve in a Blob) open in their browser (or download depending on how the browser is feeling) and if at some point the browser decides to save the file (e.g. because the user asks to save a file, or because it doesn't have an internal handler) then we'd like it to favor our proposed filename instead of a blob id.
What solutions exist today?
- We can construct a
Blobor aFilew/ aBloband callcreateObjectURLwith it. - We can create an anchor
awitha#downloadwith the href set the the url fromcreateObjectURLsuch that users can click the anchor to get our suggested filename. - We can add an iframe containing our blob url
Fwiw, Microsoft had an msSaveBlob which included a defaultName field...
How would you solve it?
Change the specification for createObjectURL so that for objects that have a name (e.g. File), browsers should prefer that name over the blob when saving.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách đọc đặc tả File API xoay quanh điểm vào createObjectURL và các định nghĩa của File, Blob và object URLs. Xác định tên tệp được đề xuất nên tương tác như thế nào với hành vi lưu, sau đó cập nhật đặc tả để định nghĩa tùy chọn đó và thêm hoặc điều chỉnh phạm vi bao phủ tính tương thích nếu đặc tả xác định một vị trí kiểm thử liên quan.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- html
- Lĩnh vực
- api, web-dev
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100