File: 0005-Fix-handling-of-file-path-feed-URIs.patch

package info (click to toggle)
python-scrapy 2.13.4-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 5,948 kB
  • sloc: python: 51,970; xml: 199; makefile: 25; sh: 7
file content (35 lines) | stat: -rw-r--r-- 1,429 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From: Andrey Rakhmatullin <wrar@wrar.name>
Date: Mon, 27 Oct 2025 20:13:12 +0500
Subject: Fix handling of file:/path feed URIs.

---
 scrapy/extensions/feedexport.py | 2 +-
 tests/test_feedexport.py        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scrapy/extensions/feedexport.py b/scrapy/extensions/feedexport.py
index 4ac5467..53ac9c6 100644
--- a/scrapy/extensions/feedexport.py
+++ b/scrapy/extensions/feedexport.py
@@ -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) if uri.startswith("file://") else 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"
diff --git a/tests/test_feedexport.py b/tests/test_feedexport.py
index 7c6425f..d557792 100644
--- a/tests/test_feedexport.py
+++ b/tests/test_feedexport.py
@@ -2690,7 +2690,7 @@ class TestFeedExporterSignals:
     with tempfile.NamedTemporaryFile(suffix="json") as tmp:
         settings = {
             "FEEDS": {
-                f"file:///{tmp.name}": {
+                f"file://{tmp.name}": {
                     "format": "json",
                 },
             },