Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F474361
Force source code to show diffs in Diffusion instead of binary
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
matelich
Jun 5 2015, 9:38 PM
2015-06-05 21:38:52 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
Force source code to show diffs in Diffusion instead of binary
View Options
diff --git a/src/parser/ArcanistDiffParser.php b/src/parser/ArcanistDiffParser.php
index 0e9627b..54da690 100644
--- a/src/parser/ArcanistDiffParser.php
+++ b/src/parser/ArcanistDiffParser.php
@@ -1020,6 +1020,16 @@ final class ArcanistDiffParser {
}
+ //For files we think are binary, double-check they're not using extensions defined as code
+ //backwards is slightly faster and way more fun
+ if($is_binary) {
+ $back_path = substr(strrev($change->getCurrentPath()), 0, 5); //5 == max of non_binary strlens
+ $reversed_non_binary_file_extensions = array("pph.","h.","php.","ppc.","lni.","sc.","lmax.","iu.");
+ foreach ($reversed_non_binary_file_extensions as $rev_ext) {
+ if(stripos($back_path, $rev_ext) === 0){
+ $is_binary = false;
+ break;
+ }
+ }
+ }
if ($is_binary) {
// SVN happily treats binary files which aren't marked with the right
// mime type as text files. Detect that junk here and mark the file
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/2c/4g/xwyxew2bdeqxpqhj
Default Alt Text
Force source code to show diffs in Diffusion instead of binary (1 KB)
Attached To
Mode
P1799 Force source code to show diffs in Diffusion instead of binary
Attached
Detach File
Event Timeline
Log In to Comment