mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Fix failing unrar test on windows (I hope)
This commit is contained in:
parent
ca7a11a289
commit
5d331a6c46
@ -11,7 +11,7 @@ import shutil
|
|||||||
import re
|
import re
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
from calibre.constants import filesystem_encoding
|
from calibre.constants import filesystem_encoding, iswindows
|
||||||
from calibre.ptempfile import PersistentTemporaryFile, TemporaryDirectory
|
from calibre.ptempfile import PersistentTemporaryFile, TemporaryDirectory
|
||||||
|
|
||||||
|
|
||||||
@ -71,9 +71,13 @@ def comment(path_or_stream):
|
|||||||
def extract_member(
|
def extract_member(
|
||||||
path_or_stream, match=re.compile(r'\.(jpg|jpeg|gif|png)\s*$', re.I), name=None):
|
path_or_stream, match=re.compile(r'\.(jpg|jpeg|gif|png)\s*$', re.I), name=None):
|
||||||
from unrardll import extract_member
|
from unrardll import extract_member
|
||||||
|
if iswindows and name is not None:
|
||||||
|
name = name.replace(os.sep, '/')
|
||||||
|
|
||||||
def is_match(header):
|
def is_match(header):
|
||||||
fname = header['filename']
|
fname = header['filename']
|
||||||
|
if iswindows:
|
||||||
|
fname = fname.replace(os.sep, '/')
|
||||||
return (name is not None and fname == name) or \
|
return (name is not None and fname == name) or \
|
||||||
(match is not None and match.search(fname) is not None)
|
(match is not None and match.search(fname) is not None)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user