fsspec: `get_file` silently writes nothing for `file://` and Windows paths

Abierto
#830 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@andyhetianjun ya está trabajando en esto.

Desde el 26/11/2026.

  • #831 de @andyhetianjun — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
58/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
api, backend

Línea de trabajo

Start by reading FsspecStore._get_file and its path handling, then check the existing tests for get_file and get. Reproduce with a file:// destination and a Windows drive path; the issue also suggests using fsspec's split_protocol. Done means local paths are written, unsupported schemes raise ValueError, and tests cover both behaviors.

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

Descripción

FsspecStore.get_file returns without writing anything, and without raising, when the local path has a URL scheme. In _get_file:

res = urlparse(lpath)
if res.scheme or await self._local_store._isdir(lpath):
    # lpath need to be local file and cannot contain scheme
    return

So get_file("...", "file:///tmp/out.txt") looks like it worked but no file is created. Repro with obstore 0.12.1 and fsspec 2026.9.0, no credentials needed:

import os
from obstore.fsspec import FsspecStore

fs = FsspecStore("memory")
fs.pipe_file("src.txt", b"hello world")

fs.get_file("src.txt", "file:///tmp/out.txt")
print(os.path.exists("/tmp/out.txt"))  # False, no error

fs.get_file("src.txt", "/tmp/out.txt")
print(os.path.exists("/tmp/out.txt"))  # True

I think this also affects Windows: urlparse(r"C:\Users\me\out.txt").scheme is "c", so every get_file, and get (which calls _get_file), to a normal Windows path takes the same early return. I only have a Mac, so I checked the urlparse part but couldn't test it end to end. #763 might also get in the way on Windows after this point.

For a path with some other scheme, like s3://bucket/key, it also returns silently. Raising an error there seems better than doing nothing.

I have a small fix with tests: use fsspec's split_protocol (which doesn't treat a drive letter as a protocol), strip file://, and raise ValueError for other protocols. I will open a PR and link it here.

Lenguaje dominante
Python
Estrellas
842
Forks
50
Merge medio
9 h
PR fusionados (30 d)
13

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

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.

Más de developmentseed/obstore

Todos los issues de developmentseed/obstore

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.