Good analysis, I guess the .d extension indeed was a misleading example.

After `has_html_view` if it returns True, the next logic often is to read the 
contents so we can display the file.  Or run a diff or something like that.  In 
the cases where we're reading the file anyway, we could do a content-based 
check to confirm it is text.  For simple file display that could work.  
Diff/commit logic might be trickier to sort out.

I'm thinking its pretty good as-is for now, and we were mostly just confused by 
the .d extension.


---

** [tickets:#7962] Better binary file detection**

**Status:** in-progress
**Milestone:** unreleased
**Labels:** 42cc 
**Created:** Wed Aug 12, 2015 03:25 PM UTC by Heith Seewald
**Last Updated:** Wed Oct 21, 2015 02:38 PM UTC
**Owner:** Igor Bondarenko


Improve our binary/text file detection.

[here is an 
example](https://sourceforge.net/p/planetexpress/git/ci/ba49bf3d9b3185ea2b0dc5cb6f7a3f8a6781f0c4/)
 of a jpg with a ".d" extention that made it through the **has_html_view** 
function(  `allura.model.repository.Blob#has_html_view`)


Performance should be a primary consideration because of the large number of 
calls on bigger commits.


---

Sent from forge-allura.apache.org because dev@allura.apache.org is subscribed 
to https://forge-allura.apache.org/p/allura/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://forge-allura.apache.org/p/allura/admin/tickets/options.  Or, if this is 
a mailing list, you can unsubscribe from the mailing list.

Reply via email to