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