diff --git a/include/class.file.php b/include/class.file.php
index ef5657313069572d745659a0120da200a7c4b82a..c0b844bfcf2c6227dae0e3cd86fbf1bbf5f93e57 100644
--- a/include/class.file.php
+++ b/include/class.file.php
@@ -546,9 +546,9 @@ class AttachmentFile extends VerySimpleModel {
     }
 
     static function lookup($id) {
-        return is_numeric($id)
-            ? parent::lookup($id)
-            : static::lookupByHash($id);
+        return is_string($id)
+            ? static::lookupByHash($id)
+            : parent::lookup($id);
     }
 
     /*