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

Đang mở
#830 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

@andyhetianjun đang làm issue này rồi.

Từ ngày 26/11/2026.

  • #831 của @andyhetianjun — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
58/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ệ
python
Lĩnh vực
api, backend

Hướng nghiên cứu

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.

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

Mô tả

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.

Ngôn ngữ chính
Python
Star
842
Fork
50
Merge trung bình
9 giờ
Pull request đã merge (30 ngày)
13

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 developmentseed/obstore

Tất cả issue của developmentseed/obstore

Issue tương tự

Thêm issue về Python

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.