limit path length for --write-pages output on Windows (#2733)
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
"""Common classes and constants used by extractor modules."""
|
"""Common classes and constants used by extractor modules."""
|
||||||
|
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
import ssl
|
import ssl
|
||||||
import time
|
import time
|
||||||
@@ -477,11 +478,16 @@ class Extractor():
|
|||||||
|
|
||||||
fname = "{:>02}_{}".format(
|
fname = "{:>02}_{}".format(
|
||||||
Extractor._dump_index,
|
Extractor._dump_index,
|
||||||
Extractor._dump_sanitize('_', response.url)
|
Extractor._dump_sanitize('_', response.url),
|
||||||
)[:250]
|
)
|
||||||
|
|
||||||
|
if util.WINDOWS:
|
||||||
|
path = os.path.abspath(fname)[:255]
|
||||||
|
else:
|
||||||
|
path = fname[:251]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(fname + ".dump", 'wb') as fp:
|
with open(path + ".txt", 'wb') as fp:
|
||||||
util.dump_response(
|
util.dump_response(
|
||||||
response, fp, headers=(self._write_pages == "all"))
|
response, fp, headers=(self._write_pages == "all"))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user