[tracker-miners/sam/index-location: 4/21] miners/fs: Only allow directory arguments to IndexFileForProcess



commit e3354c582af29535909f94bc9a9ae6482b64a066
Author: Sam Thursfield <sam afuera me uk>
Date:   Sun Mar 8 20:55:13 2020 +0100

    miners/fs: Only allow directory arguments to IndexFileForProcess
    
    The IndexFileForProcess should monitor the indexed location for changes,
    however this is only possible if it's a directory. IndexFile can still
    handle file arguments.

 src/miners/fs/tracker-miner-files-index.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/miners/fs/tracker-miner-files-index.c b/src/miners/fs/tracker-miner-files-index.c
index 82a2c0473..a6b940b8c 100644
--- a/src/miners/fs/tracker-miner-files-index.c
+++ b/src/miners/fs/tracker-miner-files-index.c
@@ -303,8 +303,22 @@ handle_method_call_index_file (TrackerMinerFilesIndex *miner,
                                                                     file);
                }
        } else {
-               tracker_miner_fs_check_file (TRACKER_MINER_FS (priv->files_miner),
-                                            file, G_PRIORITY_HIGH, do_checks);
+               if (watch_source) {
+                       internal_error = g_error_new_literal (TRACKER_MINER_INDEX_ERROR,
+                                                             TRACKER_MINER_INDEX_ERROR_DIRECTORIES_ONLY,
+                                                             "Only directories can be processed using 
IndexFileForProcess");
+                       tracker_dbus_request_end (request, internal_error);
+                       g_dbus_method_invocation_return_gerror (invocation, internal_error);
+
+                       g_error_free (internal_error);
+
+                       g_object_unref (file);
+
+                       return;
+               } else {
+                       tracker_miner_fs_check_file (TRACKER_MINER_FS (priv->files_miner),
+                                                    file, G_PRIORITY_HIGH, do_checks);
+               }
        }
 
        tracker_dbus_request_end (request, NULL);


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