From 74586d7164b42dbfc335c2c69f23f27ef614a3c6 Mon Sep 17 00:00:00 2001 From: j Date: Mon, 14 Jan 2019 17:10:40 +0530 Subject: [PATCH] compare NFD normalized paths --- oml/item/api.py | 1 + oml/item/scan.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/oml/item/api.py b/oml/item/api.py index 0fd7a6a..4493233 100644 --- a/oml/item/api.py +++ b/oml/item/api.py @@ -168,6 +168,7 @@ def remove(data): ''' if 'ids' in data and data['ids']: for i in models.Item.query.filter(models.Item.id.in_(data['ids'])): + logger.info('remove item %s', i) i.remove_file() state.cache.clear('group:') return { diff --git a/oml/item/scan.py b/oml/item/scan.py index d2f3fa6..8161203 100644 --- a/oml/item/scan.py +++ b/oml/item/scan.py @@ -7,6 +7,7 @@ import os import shutil import stat import time +import unicodedata import ox @@ -31,6 +32,7 @@ def remove_missing(books=None): prefix = get_prefix() if books is None: books = collect_books(prefix) + books = [unicodedata.normalize('NFD', path) for path in books] with db.session(): if os.path.exists(prefix): logger.debug('scan for removed files') @@ -40,6 +42,8 @@ def remove_missing(books=None): if state.shutdown: return path = f.fullpath() + path = unicode + path = unicodedata.normalize('NFD', path) db_paths.append(path) if f.item: items[path] = f.sha1