mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
When parsing fields, handle escapes
This commit is contained in:
parent
bd4e828668
commit
2aa8f23d6c
@ -37,7 +37,9 @@ scanner = re.Scanner([
|
|||||||
def parse_hyperlink(raw, log):
|
def parse_hyperlink(raw, log):
|
||||||
ans = {}
|
ans = {}
|
||||||
last_option = None
|
last_option = None
|
||||||
|
raw = raw.replace('\\\\', '\x01').replace('\\"', '\x02')
|
||||||
for token, token_type in scanner.scan(raw)[0]:
|
for token, token_type in scanner.scan(raw)[0]:
|
||||||
|
token = token.replace('\x01', '\\').replace('\x02', '"')
|
||||||
if not ans:
|
if not ans:
|
||||||
if token_type is not WORD:
|
if token_type is not WORD:
|
||||||
log('Invalid hyperlink, first token is not a URL (%s)' % raw)
|
log('Invalid hyperlink, first token is not a URL (%s)' % raw)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user