mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Sanitize filenames for notes resources
This commit is contained in:
parent
fa83be4192
commit
1fb3b9ea28
@ -11,6 +11,7 @@ from contextlib import suppress
|
|||||||
from itertools import count, repeat
|
from itertools import count, repeat
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
from calibre import sanitize_file_name
|
||||||
from calibre.constants import iswindows
|
from calibre.constants import iswindows
|
||||||
from calibre.db import FTSQueryError
|
from calibre.db import FTSQueryError
|
||||||
from calibre.db.annotations import unicode_normalize
|
from calibre.db.annotations import unicode_normalize
|
||||||
@ -322,6 +323,7 @@ class Notes:
|
|||||||
f = open(path, 'wb')
|
f = open(path, 'wb')
|
||||||
with f:
|
with f:
|
||||||
f.write(data)
|
f.write(data)
|
||||||
|
name = sanitize_file_name(name)
|
||||||
base_name, ext = os.path.splitext(name)
|
base_name, ext = os.path.splitext(name)
|
||||||
c = 0
|
c = 0
|
||||||
for (existing_name,) in conn.execute('SELECT name FROM notes_db.resources WHERE hash=?', (resource_hash,)):
|
for (existing_name,) in conn.execute('SELECT name FROM notes_db.resources WHERE hash=?', (resource_hash,)):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user