Avoid libmagic traceback on Windows.

WARNING: this release is a candidate, it only works on Linux/Unices for the moment!
This commit is contained in:
Bernardo Damele
2009-04-22 12:44:16 +00:00
parent 8c0ac767f4
commit aefa7ef988
3 changed files with 52 additions and 62 deletions

View File

@@ -742,7 +742,10 @@ def getRemoteIP():
def getFileType(filePath):
magicFileType = magic.from_file(filePath)
try:
magicFileType = magic.from_file(filePath)
except:
return "unknown"
if "ASCII" in magicFileType or "text" in magicFileType:
return "text"