[tracker-miners: 1/3] Fix duplicate entries on files created and instantly modified




commit d1b44392cc21502cfff01937b87c49306ff6198a
Author: Pekka Vuorela <pekka vuorela jolla com>
Date:   Fri Oct 29 11:05:45 2021 +0300

    Fix duplicate entries on files created and instantly modified
    
    On "touch newfile.jpg; cp oldfile.jpg newfile.jpg" the mime type
    was first detected as text/plain after the touch call and afterwards
    as proper type. With file added to two type specific graphs, the
    tracker extractor query for files without extractorHash listed the
    same file twice and the extracted content got also added twice.
    
    Side-effect, of course, is that empty files are no longer available
    outside tracker:FileSystem.
    
    Relates to https://gitlab.gnome.org/GNOME/tracker-miners/-/issues/200

 src/miners/fs/tracker-miner-files.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index dafb8dbf3..a7fed924c 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -2170,9 +2170,10 @@ miner_files_process_file (TrackerMinerFS      *fs,
 
        graph = tracker_extract_module_manager_get_graph (mime_type);
 
-       if (graph) {
+       if (graph && g_file_info_get_size (file_info) > 0) {
                /* This mimetype will be extracted by some module, pre-fill the
                 * nfo:FileDataObject in that graph.
+                * Empty files skipped as mime-type for those cannot be trusted.
                 */
                graph_file = tracker_resource_new (uri);
                tracker_resource_add_uri (graph_file, "rdf:type", "nfo:FileDataObject");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]