w3c / w3c/FileAPI

Allow `createObjectURL` to retain filename from `File` (and similar) objects

オープン
#203 コメント 7 件 リアクション 3 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
HTML
スター
118
フォーク
52
平均マージ
9日 16時間
マージ済み PR(30日)
1

説明

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?
  1. We can construct a Blob or a File w/ a Blob and call createObjectURL with it.
  2. We can create an anchor a with a#download with the href set the the url from createObjectURL such that users can click the anchor to get our suggested filename.
  3. 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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、createObjectURL エントリポイント周辺の File API 仕様と、File、Blob、object URLs の定義を読みます。提案されたファイル名が保存動作とどのように相互作用すべきかを判断し、その優先設定を定義するよう仕様を更新します。また、仕様で関連するテスト場所が特定されている場合は、適合性のカバレッジを追加または調整します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
html
領域
api, web-dev
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。