Jump to content
nikivi

Javascript files are being identified as public.folder by macOS (so don't work in a folder filter in Alfred)

Recommended Posts

I have this workflow that is a file filter that should only search folders  

 

2018-11-06 at 01.19.png

 

 

However it recently started showing me not only folders but JS files too.

 

959187456_2018-11-06at01_20.png.f604dfad995f3e64dfe0d93205555300.png

 

Is this a known bug? Anything I can do to solve this? Thank you.

Edited by nikivi

Share this post


Link to post

Hi @nikivi 

 

Step one is to rebuild your Mac's index, since if the metadata isn't correct or complete, this may occur.

 

Cheers,
Vero

Share this post


Link to post
5 hours ago, Vero said:

Step one is to rebuild your Mac's index

 

Doing that now. One thing I want to note is that when I ticked this box:

 

1786140085_2018-11-06at14_58.png.d2fc28f4c396561dbdd0edadce1c459a.png

 

When it tried to rm it, terminal said `permission denied` even though I wrote my sudo password. Perhaps that's due to SIP. Maybe it's something that should be noted?

Share this post


Link to post

Finished rebuilding the index. I still have JS files shown when it should only show Folders.

 

479204813_2018-11-06at15_30.png.6a58e9d0c6b233cfc5f761dd720a392b.png

 

Anything I can do aside from rebuilding the index to fix this?

Share this post


Link to post

@nikivi Grab the Alfred Metadata tool here and drag some of your .ts and .js files to work out what their file types are:

https://cachefly.alfredapp.com/tools/AlfredMetadataTool_v1.1.zip

 

Paste the results so we can see what file types are listed in the metadata, and whether that's why they're returned.

 

Next, copy just the File Filter object from your workflow, set a new keyword, and try using just that object (let's say, with a Reveal in Finder action added to the end)? 

 

Removing all your scripts that surrounds it will ensure results down to exclusively what the File Filter is returning, rather than anything that's then passed through scripts.

 

Cheers,
Vero

Share this post


Link to post

A JS file

 

/Users/nikivi/src/orgs/learn-anything/learn-anything/frontend/node_modules/bs-platform/lib/amdjs/unix.js
Internal File Metadata
======================
 Display Name: unix.js
    Alt Names: 
    File Type: public.folder
     Comments: 
     Keywords: 
    Last Used: 
Raw mdls File Metadata
======================
kMDItemContentCreationDate         = 2018-11-06 00:46:11 +0000
kMDItemContentCreationDate_Ranking = 2018-11-06 00:00:00 +0000
kMDItemContentModificationDate     = 2018-11-06 00:46:11 +0000
kMDItemContentType                 = "public.folder"
kMDItemContentTypeTree             = (
    "public.item",
    "public.folder",
    "public.directory"
)
kMDItemDateAdded                   = 2018-11-06 00:46:11 +0000
kMDItemDateAdded_Ranking           = 2018-11-06 00:00:00 +0000
kMDItemDisplayName                 = "unix.js"
kMDItemFSContentChangeDate         = 2018-11-06 00:46:11 +0000
kMDItemFSCreationDate              = 2018-11-06 00:46:11 +0000
kMDItemFSCreatorCode               = ""
kMDItemFSFinderFlags               = 0
kMDItemFSHasCustomIcon             = (null)
kMDItemFSInvisible                 = 0
kMDItemFSIsExtensionHidden         = 0
kMDItemFSIsStationery              = (null)
kMDItemFSLabel                     = 0
kMDItemFSName                      = "unix.js"
kMDItemFSNodeCount                 = (null)
kMDItemFSOwnerGroupID              = 20
kMDItemFSOwnerUserID               = 501
kMDItemFSSize                      = 59031
kMDItemFSTypeCode                  = ""
kMDItemInterestingDate_Ranking     = 2018-11-06 00:00:00 +0000
kMDItemKind                        = "Folder"
kMDItemLogicalSize                 = 59031
kMDItemPhysicalSize                = 61440

 

 

Share this post


Link to post

Copying file filter also searches not just folders but other files

 

1590593866_2018-11-06at17_40.thumb.png.1fb66b4e741622070dd888f5ab817040.png

Edited by nikivi

Share this post


Link to post

The file filter does specify to search only folders 

 

522219757_2018-11-06at17_50.png.1d0605f6fdc56209193fac5e1e4ffe73.png

 

Thank you for any help on solving this.

Share this post


Link to post
6 hours ago, nikivi said:

A JS file


/Users/nikivi/src/orgs/learn-anything/learn-anything/frontend/node_modules/bs-platform/lib/amdjs/unix.js
Internal File Metadata
======================
 Display Name: unix.js
    Alt Names: 
    File Type: public.folder

 

 

Anything look funny to you, Niki?

Edited by deanishe
Remove excess space

Share this post


Link to post

Oh wow. How can a JS file be of this type? ?

 

Not sure what I can do. Perhaps my system is messed up and I need to reformat my drive. Don’t really want to do that. 

Share this post


Link to post
3 hours ago, deanishe said:

 

Forgive me for perhaps a silly question but I read through that document few times and I don't get how do I find what app defines JavaScript files? Is it the app that is set to default open the file type? 

 

So in my case I'd run:

 

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -u /Applications/Visual\ Studio\ Code.app

Share this post


Link to post
15 minutes ago, nikivi said:

I don't get how do I find what app defines JavaScript files?

 

My system shows JS files as having the UTI com.netscape.javascript-source. So you should grep your /Applications directory for com.netscape.javascript-source to see which app defines that UTI. On my machine, that would be BBEdit, VimR, VoodooPad and TextMate. Installing (and running) one of those apps might also fix your problem.

 

VS Code supports .js files, but it doesn't define a UTI for them, so that likely won't work.

 

(This stuff is all defined in an app's info.plist.)

Edited by deanishe

Share this post


Link to post

I got this (rg is ripgrep).

 

/Applications
❯ rg com.netscape.javascript-source
Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework/Versions/A/Resources/StandardFileTypes.xcspec
381:        UTI = "com.netscape.javascript-source";
Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/CoreServices.framework/Headers/UTCoreTypes.h
464: *    UTI: com.netscape.javascript-source
525: *    com.netscape.javascript-source
Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/System/Library/Frameworks/CoreServices.framework/Headers/UTCoreTypes.h
464: *    UTI: com.netscape.javascript-source
525: *    com.netscape.javascript-source
Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreServices.framework/Headers/UTCoreTypes.h
464: *    UTI: com.netscape.javascript-source
525: *    com.netscape.javascript-source
Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/CoreServices.framework/Headers/UTCoreTypes.h
464: *    UTI: com.netscape.javascript-source
525: *    com.netscape.javascript-source
Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/CoreServices.framework/Headers/UTCoreTypes.h
464: *    UTI: com.netscape.javascript-source
525: *    com.netscape.javascript-source
Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/Frameworks/CoreServices.framework/Headers/UTCoreTypes.h
464: *    UTI: com.netscape.javascript-source
525: *    com.netscape.javascript-source
Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Headers/UTCoreTypes.h
464: *    UTI: com.netscape.javascript-source
525: *    com.netscape.javascript-source


```

 

Neither of these are apps it seems. Going to install BBEdit and open .js file .d.ts and .ts files and hope that fixes it.

Share this post


Link to post
5 minutes ago, nikivi said:

Going to install BBEdit and open .js file .d.ts and .ts files and hope that fixes it.

 

Didn't work. ?

Share this post


Link to post
10 minutes ago, deanishe said:

Try re-registering BBEdit with lsregister

 

Tried that. Didn't help.

 

10 minutes ago, deanishe said:

 

I don't have LaunchServices.framework in Frameworks so I can't run the mentioned in that article command.

 

1561175655_2018-11-07at00_51.png.cb02fc965ea9f64782c82c350a35b0ee.png

 

I can try run:

 

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user

 

But I want to make sure that it would do the same thing. Is it safe to run?

Edited by nikivi

Share this post


Link to post
2 minutes ago, nikivi said:

But I want to make sure that it would do the same thing.

 

Of course it's the same thing.That's an old article. Things move around. 

Share this post


Link to post
5 hours ago, dfay said:

use the instructions linked here to rebuild LS

 

Didn't help sadly:

 

1284257398_2018-11-08at17_51.png.cb0a00105777f40c8b02f248db789807.png

 

The file types are all still public.folder.

 

/Users/nikivi/src/orgs/learn-anything/learn-anything/frontend/node_modules/reason-apollo/lib/bs/src/ApolloClient.mlast.d
Internal File Metadata
======================
 Display Name: ApolloClient.mlast.d
    Alt Names: 
    File Type: public.folder
     Comments: 
     Keywords: 
    Last Used: 
Raw mdls File Metadata
======================

 

Is the only other solution to format my disk?

Edited by nikivi

Share this post


Link to post

It could be that one of the apps that you have installed is defining that JS files to be of type public folder, and even rebuilding the launch services database won't fix things because of whichever app this is.

 

The first answer on here gives more info to save me typing more about this:

https://superuser.com/questions/263311/on-os-x-how-do-you-change-a-files-kind

 

If you could work out which app it is and delete that app, you may have more luck when trying to re-associate these files.

Share this post


Link to post

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
×