mirror of https://github.com/scrapy/scrapy.git
Fix FileFeedStorage handling of Windows paths without file:// scheme (#6897)
This commit is contained in:
parent
712e965dbd
commit
0d86fb69dc
|
|
@ -185,7 +185,7 @@ class StdoutFeedStorage:
|
|||
@implementer(IFeedStorage)
|
||||
class FileFeedStorage:
|
||||
def __init__(self, uri: str, *, feed_options: dict[str, Any] | None = None):
|
||||
self.path: str = file_uri_to_path(uri)
|
||||
self.path: str = file_uri_to_path(uri) if uri.startswith("file://") else uri
|
||||
feed_options = feed_options or {}
|
||||
self.write_mode: OpenBinaryMode = (
|
||||
"wb" if feed_options.get("overwrite", False) else "ab"
|
||||
|
|
|
|||
|
|
@ -155,6 +155,11 @@ class TestFileFeedStorage:
|
|||
finally:
|
||||
path.unlink()
|
||||
|
||||
def test_preserves_windows_path_without_file_scheme(self):
|
||||
path = r"C:\Users\user\Desktop\test.txt"
|
||||
storage = FileFeedStorage(path)
|
||||
assert storage.path == path
|
||||
|
||||
|
||||
class TestFTPFeedStorage(unittest.TestCase):
|
||||
def get_test_spider(self, settings=None):
|
||||
|
|
|
|||
Loading…
Reference in New Issue