Jump to content

File Search finding ~/Library files


Recommended Posts

Hi Alfred Team,

 

Recently I've noticed a lot of Mail attachment downloads appearing in my File Search.

  1. I use [spacebar] to start a File Search and start typing, e.g. abc
  2. The results show a list of files, one which is in my documents folder and the rest which are in '~/Library/Mail/V5/x/x/x/abc.txt

 

I've been able to do a workaround by:

  1. Preference > Default Results > Uncheck "Include folders in Home"
  2. Add all folders in Home excluding ~/Library into Search Scope 

 

It seems the grey help text "Excluding ~/Library" under the check box is not being honored.

 

Versions:

macOS 10.13.2 (17C88)

Alfred v3.6.2 [922] Powerpack

 

Thanks in advance 

 

Ben

Link to comment

@bmazin Alfred shouldn't include ~/Library by default, even with folders in home selected. If you haven't manually added this folder to the scope, it might be worth rebuilding your macOS index as there may be an internal macOS metadata issue. There is a shortcut for this in Alfred's Advanced preferences.

 

Cheers,

Andrew

 

[Moving to discussion and help]

Link to comment
  • 4 months later...

I've created a hack with a workflow to workaround this bug.

  1. Change the General Alfred Hotkey to something else
  2. Disable Quick Search in "File Search" preference pane
  3. Create a new workflow
    1. Hotkey with:
      1. Action = Show in Alfred
      2. Argument = Text
      3. Value = '
    2. File Filter
      1. Keyword = '
      2. Search Scope = desired files
    3. Open File

 

Screen Shot 2019-01-14 at 22.53.55.png

Screen Shot 2019-01-14 at 22.54.08.png

Screen Shot 2019-01-14 at 22.54.29.png

Screen Shot 2019-01-14 at 22.54.37.png

Link to comment

@bmazin @ben.mcmurry Could you please both provide me with the following screenshots?

 

  1. Your Default Results settings (with the prefs window large enough to be able to see the full search scope)
  2. Your File Search settings

Next, reset the search scope to the defaults and uncheck "Include folders in Home". Add your Home folders one by one to the Search Scope until you start seeing the Mail attachments once again.

 

This will then allow you to narrow down which folder is causing the mail attachments to show up when they shouldn't. Our theory is that there may be a file system link hidden in one of those folders, causing these unexpected results to be included. If you can narrow down to it, it'll make it easier to either remove that file system link or tweak your scope accordingly.

 

Let me know how you get on :)

 

Cheers,
Vero

 

 

Link to comment

Thanks Vero for the suggestions,

I've done as suggested.

  1. Took Screenshots of "Default Results" and "File Search" settings (see images 01 - 08)
  2. Unchecked "Include folders in Home", dragged in every folder in Home Folder into Search Scope, excluding ~/Library (see image 09)
  3. Alfred is now searching correctly compared to when "Include folders  in  Home" is checked, (see images 10 - 11)

You can view the screenshots here - https://www.dropbox.com/sh/tnafsy4c1rvw138/AAApSYur3yRP4gZSPR1r0p11a?dl=0

 

Thanks 

 

Ben

Link to comment

@ben.mcmurry Thanks for providing this. Could you please then follow the steps in the rest of my post and let me know the outcome?

 

5 hours ago, Vero said:

Next, reset the search scope to the defaults and uncheck "Include folders in Home". Add your Home folders one by one to the Search Scope until you start seeing the Mail attachments once again.

 

This will then allow you to narrow down which folder is causing the mail attachments to show up when they shouldn't. Our theory is that there may be a file system link hidden in one of those folders, causing these unexpected results to be included. If you can narrow down to it, it'll make it easier to either remove that file system link or tweak your scope accordingly.

 

Cheers,
Vero

Link to comment

I did that. After adding each folder individually, the error did not come back. Also, the results in the documents folder (~/Library/Mobile Documents) were no longer visible. They only become visible when checking the include folders in Home box, but then all the mail attachments show up again.

Link to comment

When you tick for Alfred to include folders in home, Alfred enumerates the folders (NSURLIsDirectoryKey) in ~/ with the filter "NSDirectoryEnumerationSkipsHiddenFiles", and also excludes the suffix "/Library". The returned list is added to the list of manually added items in the search scope, and should be no different to manually adding these folders yourself.

 

What we need to work out is why, in the case of your two Macs, there are additional folders being added which are subsequently resolving through to where your Mail attachments are being stored (~/Library/Mail/).

 

I have a few theories, perhaps NSDirectoryEnumerationSkipsHiddenFiles is failing and Alfred is also adding a hidden folder which is somehow linked through to the mail folder, but it's extremely difficult for me to investigate this without access to your Mac.

 

If you open Finder to your home folder, then use cmd+shift+. this will show all hidden files and folders. Perhaps start adding in the hidden folders to Alfred's default search scope (with home folders unchecked) until this problem is exhibited, this will give us a clue where to start looking for the culprit.

 

Cheers,

Andrew

Link to comment

Hi @Andrew,

 

I tired as suggested, showing invisible files showed a number of Files and Folders

  1. Drag all Folders into default search scope
    1. No issue with Mail/Message attachments appearing in Alfred
  2. Drag a File into default search scope
    1. Issue reappeared with Mail/Message attachments appearing in Alfred
    2. It appears dragging a file into default search scope adds "~", I'm assuming this is adding entire Home folder to scope

 

Below is a list of files/folders in my home folder using terminal "ls -al" command.

Let me know if I can do/provide anything else to help?

 

Ben

 

~ ben$ ls -al

total 136

drwxr-xr-x+   31 ben   staff    992 Jan 16 06:47 .

drwxr-xr-x     5 root  admin    160 Oct 21 09:02 ..

srwxr-xr-x     1 ben   staff      0 Jan 14 18:11 .Box_EngineServer

srwxr-xr-x     1 ben   staff      0 Jan 14 18:11 .Box_StreemToSync

srwxr-xr-x     1 ben   staff      0 Jan 14 18:11 .Box_SyncToStreem

srwxr-xr-x     1 ben   staff      0 Jan 14 18:11 .Box_UIServer

-r--------     1 ben   staff      7 Nov 27  2017 .CFUserTextEncoding

-rw-r--r--@    1 ben   staff  10244 Jan 16 06:54 .DS_Store

drwx------  3072 ben   staff  98304 Jan 16 06:47 .Trash

-rw-------     1 ben   staff  23466 Jan 15 21:37 .bash_history

drwx------   466 ben   staff  14912 Jan 16 06:54 .bash_sessions

drwxr-xr-x     8 ben   staff    256 Nov 27  2017 .cisco

drwxr-xr-x     3 ben   staff     96 Mar 20  2018 .config

drwx------     3 ben   staff     96 Dec  7  2017 .cups

drwx------    15 ben   staff    480 Dec 27 11:00 .gnupg

-rw-------     1 ben   staff     78 Aug  1 23:48 .lesshst

drwxr-xr-x     8 ben   staff    256 Jul 26 14:19 .oracle_jre_usage

drwxr-xr-x    81 ben   staff   2592 Jan 16 06:50 .sqldeveloper

-rw-------     1 ben   staff     13 Mar 15  2018 .sqlite_history

drwx------     9 ben   staff    288 Jan 14 17:18 .ssh

-rw-------     1 ben   staff  14969 Jul  4  2018 .viminfo

drwx------@    3 ben   staff     96 Dec  6  2017 Applications

drwxr-xr-x@   11 ben   staff   4096 Jan 15 22:15 Box

drwx------+   11 ben   staff    352 Jan 15 23:09 Desktop

drwx------+   11 ben   staff    352 Jan 14 22:18 Documents

drwx------+    8 ben   staff    256 Jan 16 06:50 Downloads

drwx------+   83 ben   staff   2656 Jan  2 12:00 Library

drwx------+    5 ben   staff    160 Oct 21 08:05 Movies

drwx------+    4 ben   staff    128 Dec 31  2017 Music

drwx------+    4 ben   staff    128 Nov 27  2017 Pictures

drwxr-xr-x+    5 ben   staff    160 Nov 27  2017 Public

Link to comment
11 hours ago, bmazin said:

@ben.mcmurry for ~/Library/Mobile Documents, I dragged that folder into the search scope manually (without checking "Include folders in Home".

This allowed me to search iCloud documents without Mail (and iMessage) attachments/downloads appearing in results.

 Thanks @bmazin. Unfortunately, that did not work. I see that it is one of the default directories so I removed it and re-added it. Still nothing. :(

Link to comment
6 hours ago, Andrew said:

If you open Finder to your home folder, then use cmd+shift+. this will show all hidden files and folders. Perhaps start adding in the hidden folders to Alfred's default search scope (with home folders unchecked) until this problem is exhibited, this will give us a clue where to start looking for the culprit.

@Andrew, thanks. I just tried that and still nothing. In order to see my documents in ~/Library/Mobile Documents/ it looks like I have to tick the box to search for home and live with the inclusion of mail attachments. I'm tempted to do a fresh reinstall of Alfred to see if that will fix the problem. 

Link to comment

@bmazin If you drag a file into Alfred's default scope, it does add the containing folder - This is to just make adding folders to the scope easier. Obviously, once ~ is in Alfred's scope, it's going to search everything within ~.

 

When manually adding all the folders, did you try adding in all the finite ones (dot prefixed)?

 

Also, I see you have some Box sync items there, I'm wondering if these are having an affect.

 

@bmazin - Could you pop an email to our info@ address, I'm going to give you a build which will log the actual folders Alfred is including in the scope when folders in home is selected on your Mac. This should let us know where the discrepancy is.

 

Cheers,

Andrew

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...