diff --git a/include/class.file.php b/include/class.file.php
index e502ff80507e89c91040de4f099c8e46caddc327..580330b64cc8731cd1031c0e5974f1655e281e6b 100644
--- a/include/class.file.php
+++ b/include/class.file.php
@@ -531,11 +531,16 @@ class AttachmentFile extends VerySimpleModel {
     static function getBackendForFile($file) {
         global $cfg;
 
-        if (!$cfg)
+        $char = null;
+        if ($cfg) {
+            $char = $cfg->getDefaultStorageBackendChar();
+        }
+        try {
+            return FileStorageBackend::lookup($char ?: 'D', $file);
+        }
+        catch (Exception $x) {
             return new AttachmentChunkedData($file);
-
-        $char = $cfg->getDefaultStorageBackendChar();
-        return FileStorageBackend::lookup($char, $file);
+        }
     }
 
     static function lookupByHash($hash) {