diff --git a/include/class.thread.php b/include/class.thread.php
index a2a7cb91c44255d1271fd15d5dc5aab1d6e2fb05..31353b99834b4d9460f5141e9fa8c3952f89b22f 100644
--- a/include/class.thread.php
+++ b/include/class.thread.php
@@ -1048,7 +1048,7 @@ Class ThreadEntry {
                 // content-id will be discarded, only the unique hash-code
                 // will be available to retrieve the image later
                 if ($a['cid'] && $a['key']) {
-                    $body = preg_replace('/src=("|\'|\b)cid:'.$a['cid'].'\1/i',
+                    $body = preg_replace('/src=("|\'|\b)(?:cid:)?'.$a['cid'].'\1/i',
                         'src="cid:'.$a['key'].'"', $body);
                 }
             }