@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix a fatal if a directory listing contains a non-file called 'readme'

Summary: See T1665. If you have a directory named 'readme', we try to read it as a README.

Test Plan: Created a directory named 'readme', hit a similar fatal to the one in T1665, applied this patch, everything worked great.

Reviewers: btrahan, vrana

Reviewed By: vrana

CC: aran

Maniphest Tasks: T1665

Differential Revision: https://secure.phabricator.com/D3312

+8 -1
+8 -1
src/applications/diffusion/query/browse/DiffusionBrowseQuery.php
··· 95 95 96 96 $readme = null; 97 97 foreach ($results as $result) { 98 + $file_type = $result->getFileType(); 99 + if (($file_type != ArcanistDiffChangeType::FILE_NORMAL) && 100 + ($file_type != ArcanistDiffChangeType::FILE_TEXT)) { 101 + // Skip directories, etc. 102 + continue; 103 + } 104 + 98 105 $path = $result->getPath(); 106 + 99 107 if (preg_match('/^readme(|\.txt|\.remarkup|\.rainbow)$/i', $path)) { 100 108 $readme = $result; 101 109 break; ··· 117 125 $readme_request); 118 126 $content_query->loadFileContent(); 119 127 $readme_content = $content_query->getRawData(); 120 - 121 128 122 129 if (preg_match('/\\.txt$/', $readme->getPath())) { 123 130 $readme_content = phutil_escape_html($readme_content);