diff --git a/include/class.thread.php b/include/class.thread.php
index 8ba433c8f8e37f0d99bbecaa62c12170d7f131a0..aa78f1acb8dc60afffd9d540c38b8fe7664d0cba 100644
--- a/include/class.thread.php
+++ b/include/class.thread.php
@@ -1048,7 +1048,8 @@ 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:)?'.preg_quote($a['cid']).'\1/i',
+                    $body = preg_replace('/src=("|\'|\b)(?:cid:)?'
+                        . preg_quote($a['cid'], '/').'\1/i',
                         'src="cid:'.$a['key'].'"', $body);
                 }
             }