Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

Last modified 12 years ago

#5796 closed defect (fixed)

Mime guessing doesn't work for shebang using /usr/bin/env

Reported by: Tim Hatch Owned by: Tim Hatch
Priority: normal Milestone: 0.11
Component: general Version: devel
Severity: normal Keywords: mimeview
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

For files without an extension in the mime map, the guessing code looks for a line like

#!/usr/bin/python

This works great except for a lot of scripts these days (such as our own post commit hook) use

#!/usr/bin/env python

I propose making a reasonably trivial change to get_mimetype() that will make it recognize this syntax.

While I'm in there tweaking stuff, I'd also like to support some more vim-isms in modelines, such as filetype= and modelines near the bottom of the file (:help modelines reports that the first or last 5 are checked by default).

Thoughts?

Attachments (1)

get_mimetype_r5883.diff (2.2 KB ) - added by Tim Hatch 17 years ago.
Working version against r5883, for review

Download all attachments as: .zip

Change History (3)

by Tim Hatch, 17 years ago

Attachment: get_mimetype_r5883.diff added

Working version against r5883, for review

comment:1 by Tim Hatch, 17 years ago

Resolution: fixed
Status: newclosed

Fixed in r5889

comment:2 by Christian Boos, 12 years ago

Milestone: 0.11

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Tim Hatch.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Tim Hatch to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.