w3c / w3c/FileAPI

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

Abierto
#203 7 comentarios 3 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
HTML
Estrellas
118
Forks
52
Merge medio
9 d 16 h
PR fusionados (30 d)
1

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza leyendo la especificación de File API en torno al punto de entrada createObjectURL y las definiciones de File, Blob y object URLs. Determina cómo debería interactuar un nombre de archivo propuesto con el comportamiento de guardado y, a continuación, actualiza la especificación para definir esa preferencia y añade o ajusta la cobertura de conformidad si la especificación identifica una ubicación de prueba relevante.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
html
Área
api, web-dev
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.