From ebec4ad4f9051c9101dfb1ff331ea5a1a1832094 Mon Sep 17 00:00:00 2001
From: "Alan J. Pippin" <ajp@pippins.net>
Date: Sun, 1 Feb 2009 13:58:06 -0700
Subject: [PATCH] Added code to strip trailing whitespace off URL, which causes
 issues when actually embedding the video.

---
 ItemAddEmbedVideo.inc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ItemAddEmbedVideo.inc b/ItemAddEmbedVideo.inc
index bfb8daa..bbb941d 100644
--- a/ItemAddEmbedVideo.inc
+++ b/ItemAddEmbedVideo.inc
@@ -175,8 +175,12 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
 	   $unsupported_url=0;
 	   
 	   /* Store the passed URL in a shorter local variable */
+	   /* Strip trailing whitespace in the url, this will cause problems later */
 	   $url = $form['webPage']['URL'];
-
+           if(preg_match("/(.*?)\s+/",$url,$matches)) {
+	     $url = $matches[1];
+	   }
+	   
 	   /*
 	    *****************************
 	    * Embed a Youtube Video
-- 
2.34.1