From 8aeb3ec2fb2596ddef0200122583c23b0d549351 Mon Sep 17 00:00:00 2001
From: Michael Vogel <icarus@dabo.de>
Date: Sun, 15 Jul 2012 13:12:24 +0200
Subject: [PATCH] Corrected the fix for images with links

---
 include/bb2diaspora.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index 25e4640b3a..1a7d8eaffa 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -202,7 +202,7 @@ function bb2diaspora($Text,$preserve_nl = false) {
 	// the following was added on 10-January-2012 due to an inability of Diaspora's
 	// new javascript markdown processor to handle links with images as the link "text"
 	// It is not optimal and may be removed if this ability is restored in the future
-	$Text = preg_replace("/\[url\=([^\[\]]*)\]\[img\](.*?)\[\/img\]\[\/url\]/ism",
+	$Text = preg_replace("/\[url\=([^\[\]]*)\]\s*\[img\](.*?)\[\/img\]\s*\[\/url\]/ism",
 				"[img]$2[/img]\n[url]$1[/url]", $Text);
 
 	// Convert it to HTML - don't try oembed
-- 
2.39.5