Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble with Extensions in OS X Catalina #86

Closed
timbrucks opened this issue Oct 11, 2019 · 8 comments
Closed

Trouble with Extensions in OS X Catalina #86

timbrucks opened this issue Oct 11, 2019 · 8 comments

Comments

@timbrucks
Copy link

I've been using this great plugin for a long time, thanks so much!

I just upgraded to OS X Catalina and I am having the following issue. I was not having this issue 2 days ago, before I upgraded the OS.

I have many text files that I have generated and I have given some file extension (say for example .gt but the problem occurs for a number of different extensions). Prior to the OS upgrade, I could QL those files just fine. But now all I see when I activate QL is a generic file icon rather than a preview.

If I take one of those files and remove the extension (or change it to .txt), QL generates a preview no problem.

I've tried reinstalling QLStephen two ways. (1) using homebrew, and (2) by downloading the latest version and copying the QLStephen.qlgenerator directory to /Library/QuickLook/. Then I run 'qlmange -r' but no luck. In my ~/Library/ directory, there is no QuickLook folder/ and I ran a find command in the terminal to see if OS X Catalina is hiding a Quicklook directory somewhere else, but I did not see one.

If I run
'mdls -name lKMItemContentType <file name.gt>
The output is
lKMItemContentType = (null)

Same thing if the file extension is removed, or changed to .txt

If I run
qlmanage -m | grep public

The result is:

public.data -> /Library/QuickLook/QLStephen.qlgenerator (1.4.4 - loaded)
public.movie -> /System/Library/QuickLook/Movie.qlgenerator (903.2)
public.x509-printable-encoded-archive -> /System/Library/QuickLook/Security.qlgenerator (55139.0.1)
public.xml -> /System/Library/QuickLook/Text.qlgenerator (903.2)
public.font -> /System/Library/QuickLook/Font.qlgenerator (903.2)
public.x509-certificate -> /System/Library/QuickLook/Security.qlgenerator (55139.0.1)
public.vcard -> /System/Library/QuickLook/Contact.qlgenerator (903.2)
public.html -> /System/Library/QuickLook/Web.qlgenerator (903.2)
public.plain-text -> /System/Library/QuickLook/Text.qlgenerator (903.2)
public.audio -> /System/Library/QuickLook/Audio.qlgenerator (903.2)
public.xhtml -> /System/Library/QuickLook/Web.qlgenerator (903.2)
public.json -> /System/Library/QuickLook/Text.qlgenerator (903.2)
public.svg-image -> /System/Library/QuickLook/Web.qlgenerator (903.2)
public.image -> /System/Library/QuickLook/Image.qlgenerator (903.2)
public.rtf -> /System/Library/QuickLook/Text.qlgenerator (903.2)
public.comma-separated-values-text -> /System/Library/QuickLook/Office.qlgenerator (40)`

If I force qlmanage to use the QLStephen.qlgenerator:

qlmanage -g /Library/QuickLook/QLStephen.qlgenerator -c public.plain-text -p <file name>

I see a preview. It also works if i run the command above with -c public.data.

Any ideas?

@sballin
Copy link

sballin commented Nov 11, 2019

I'm on Mojave and I experience this as well.

@mdahlman
Copy link

I'm unable to preview text files with arbitrary extensions in Catalina as well. My troubleshooting skills have not turned up the exact reason why it fails... so I haven't figured out any way of working around it. It would be lovely is someone with deeper knowledge of macOS would explain what's going wrong.

@mdahlman
Copy link

mdahlman commented Feb 4, 2020

I continue to have the same symptoms. I'm adding some details in case it will trigger any ideas in anyone to offer suggestions.

  • I installed via homebrew.
  • I'm on MacOS 10.15.3 (Catalina).
  • QLStephen is working well for files with no extensions. (So I don't see how permissions could be at play here.) Example: "catalina-bak" previews nicely now the qlstephen is installed!
  • QLStephen is working well for explicit extensions. I followed the canonical issue 23 to add support for .yaml, as an example.
  • But QLStephen is not working for files with extensions not explicitly added. Example: "catalina.out".

The file metadata is "normal", I think, for an unregistered extension:

$ mdls -name kMDItemContentType catalina.out
kMDItemContentType = "dyn.ah62d4rv4ge8087py"

$ mdls -name kMDItemContentTypeTree catalina.out
kMDItemContentTypeTree = (
    "public.item",
    "dyn.ah62d4rv4ge8087py",
    "public.data"
)

According to issue 23:
If no specific UTI is defined for *.out, then qlstephen should handle the preview, unless blacklisted.

Is qlstephen blacklisted? I don't think so. It's just an *.out file, and the same issue applies to all my text files with non-standard extensions.

Is anything competing with QLStephen? I don't think so. QLStephen owns public.data, and no other plug-in claims it.

$ qlmanage -m plugins | grep "out\|public\.data\|public\.item\|text"
  public.data -> /Users/mdahlman/Library/QuickLook/QLStephen.qlgenerator (1.4.4)
  org.oasis-open.opendocument.text -> /System/Library/QuickLook/Text.qlgenerator (906)
  com.apple.finder.textclipping -> /System/Library/QuickLook/Clippings.qlgenerator (906)
  public.plain-text -> /System/Library/QuickLook/Text.qlgenerator (906)
  public.comma-separated-values-text -> /System/Library/QuickLook/Office.qlgenerator (40 - loaded)

But this command only gives me the classic useless preview:
$ qlmanage -p catalina.out
Screen Shot 2020-02-03 at 4 59 36 PM

Forcing QuickLook to use QLStephen works just fine:

$ qlmanage -d4 -p catalina.out -g ~/Library/QuickLook/QLStephen.qlgenerator -c ''
qlmanage: argument for -d is deprecated, use Console info logs with subsystem com.apple.quicklook, categories Generator and/or Client
Testing Quick Look preview with files:
	catalina.out
	- force using content type UTI:
	- force using generator at path: /Users/mdahlman/Library/QuickLook/QLStephen.qlgenerator
2020-02-03 18:13:46.665 qlmanage[22558:173489] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x7007, name = 'com.apple.coredrag'
See /usr/include/servers/bootstrap_defs.h for the error codes.
2020-02-03 18:13:46.755 qlmanage[22558:173489] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x1451f, name = 'com.apple.tsm.portname'
See /usr/include/servers/bootstrap_defs.h for the error codes.

Do those permissions issues matter? I don't see how they could matter, since the Quick Look works in this case... but I included them in case they are a problem.

Likewise, simply forcing the UTI works as well:
$ qlmanage -d4 -p catalina.out -c 'public.data'

But I have no idea how to get it working from Finder.

So... any ideas about what's missing in my environment? It's killing me.

@xupefei
Copy link

xupefei commented Feb 4, 2020

@mdahlman I have observed the same on my machine.
It appears that the only way to let QLStephen preview a file having a random extension is to add the corresponding "dyn.*" to QLStephen's plist.

From all of the tests, I would say the workflow of Quick Look is as follows:

Quick Look will look for any suitable qlgenerator with the "specific identifier" (like "dyn.*", "public.jpeg"). If no qlgenerator is found, then Quick Look will search for a qlgenerator again using the parent type of the file:

  1. Before macOS 10.15: The top-most parent is the root (public.item: https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html).
  2. On macOS 10.15: The top-most parent is somewhere below the root. At least public.item and public.data and public.content are excluded (maybe manually by the programmer).

If this is not a bug, I would say it is designed yo enchance the security. Before 10.15, a qlgenerator that handles public.item can read the content of any file you previewed.

@tsdorsey
Copy link
Collaborator

tsdorsey commented Feb 5, 2020

This should be fixed in 1.5.1

@tsdorsey tsdorsey closed this as completed Feb 5, 2020
@mdahlman
Copy link

mdahlman commented Feb 6, 2020

@tsdorsey, you are a hero! A giant among men. A king amongst kings. A restorer of faith in the power of humanity to collectively overcome obstacles like little preview windows that don't work well.
I'm selfishly hoping that it is available via homebrew quickly. But one way or another I'll get 1.5.1 installed soon. Thanks for you work on this.

@xupefei
Copy link

xupefei commented Feb 6, 2020

With version 1.5.1, I am still not able to preview a file if it has a random extension. An example:

$ mdls -name kMDItemContentType btkeys.reg
kMDItemContentType = "dyn.ah62d4rv4ge81e3ph"
$ mdls -name kMDItemContentTypeTree btkeys.reg
kMDItemContentTypeTree = (
    "public.item",
    "dyn.ah62d4rv4ge81e3ph",
    "public.data"
)

QLStephen info:

$ qlmanage -m | grep Ste
  public.data -> /Users/paddy/Library/QuickLook/QLStephen.qlgenerator (1.5.1)
  public.content -> /Users/paddy/Library/QuickLook/QLStephen.qlgenerator (1.5.1)

Seems Quick Look still didn't use public.data for .reg files even though it is in the type tree & is declared by QLStephen.

@tsdorsey
Copy link
Collaborator

tsdorsey commented Feb 6, 2020

@xupefei yeah, there is a discussion about this over in issue #87
I'm all ears about how to solve this.

Repository owner locked as resolved and limited conversation to collaborators Feb 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants