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

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

メンテナーはふだん 1 日以内に返信

@andyhetianjun がすでに取り組んでいます。

2026年11月26日 から。

  • #831 @andyhetianjun による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
58/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
api, backend

調査の方向性

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.

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

説明

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.

主要言語
Python
スター
842
フォーク
50
平均マージ
9時間
マージ済み PR(30日)
13

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

developmentseed/obstore のほかの issue

developmentseed/obstore の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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