Method which returns True if the following file content should be included in the response. Right now we exclude any file with UTF8 BOM character in it - those are most likely binary files such as icon, etc.
(self, file_path, content)
| 150 | return result |
| 151 | |
| 152 | def _include_file(self, file_path, content): |
| 153 | """ |
| 154 | Method which returns True if the following file content should be included in the response. |
| 155 | |
| 156 | Right now we exclude any file with UTF8 BOM character in it - those are most likely binary |
| 157 | files such as icon, etc. |
| 158 | """ |
| 159 | if codecs.BOM_UTF8 in content[:1024]: |
| 160 | return False |
| 161 | |
| 162 | if b"\0" in content[:1024]: |
| 163 | # Found null byte, most likely a binary file |
| 164 | return False |
| 165 | |
| 166 | return True |
| 167 | |
| 168 | |
| 169 | class FileController(BaseFileController): |