From 7c88ab2836b87cb19620830cfc1c2475228671c2 Mon Sep 17 00:00:00 2001 From: Hugh Davenport Date: Fri, 5 Jan 2024 17:44:03 +1300 Subject: [PATCH] Assistant: Check for access before showing results --- Userland/Applications/Assistant/Providers.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Userland/Applications/Assistant/Providers.cpp b/Userland/Applications/Assistant/Providers.cpp index 11c5e85c4db..247ad1b7b40 100644 --- a/Userland/Applications/Assistant/Providers.cpp +++ b/Userland/Applications/Assistant/Providers.cpp @@ -66,7 +66,9 @@ void URLResult::activate() const AppProvider::AppProvider() { Desktop::AppFile::for_each([this](NonnullRefPtr app_file) { - m_app_file_cache.append(move(app_file)); + if (access(app_file->executable().characters(), X_OK) == 0) { + m_app_file_cache.append(move(app_file)); + } }); } @@ -224,6 +226,10 @@ void FileProvider::build_filesystem_cache() return IterationDecision::Continue; auto full_path = LexicalPath::join(directory.path().string(), entry.name).string(); + + if (access(full_path.characters(), X_OK) != 0) + return IterationDecision::Continue; + m_full_path_cache.append(full_path); if (S_ISDIR(st.st_mode)) {