Skip to content

Directories should have MIME type inode/directory. - #3836

Merged
kovidgoyal merged 1 commit into
kovidgoyal:masterfrom
william-gooch:folder-mime
Jul 16, 2021
Merged

kovidgoyal merged 1 commit into
kovidgoyal:masterfrom
william-gooch:folder-mime

Conversation

@william-gooch

Copy link
Copy Markdown
Contributor

Currently, one can't assign a custom action to folders in hyperlinks because they aren't associated a MIME type. This is because python's mimetypes library doesn't include that mime type. You also can't add this in the .config/kitty/mime.types file because folders have no extension.

This way any directories automatically get the right MIME type.

@Luflosi

Luflosi commented Jul 16, 2021

Copy link
Copy Markdown
Contributor

Since os.path.isdir() and inode/directory both call it a directory, I suggest renaming is_folder() to is_directory().

@kovidgoyal

Copy link
Copy Markdown
Owner

Couple of comments:

  1. I am not comfortable with having guess_type perform filesystem I/O in general. Add a parameter named check_for_dirs defaulting to False and when guess_type is called for open actions use it.

  2. Add some documentation for this mime/type to docs/open_actions.rst

  3. Add a changelog entry for this to docs/changelog.rst

@kovidgoyal

Copy link
Copy Markdown
Owner

Actually maybe name the parameter allow_filesystem_access rather than check_for_dirs

@Luflosi

Luflosi commented Jul 16, 2021

Copy link
Copy Markdown
Contributor

You can fix the CI failure by having two empty lines above and below the new function.

@kovidgoyal
kovidgoyal merged commit a963089 into kovidgoyal:master Jul 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants