diff --git a/app/helpers/status_messages_helper.rb b/app/helpers/status_messages_helper.rb
index 6b163ed7d..2e010715a 100644
--- a/app/helpers/status_messages_helper.rb
+++ b/app/helpers/status_messages_helper.rb
@@ -19,8 +19,8 @@ module StatusMessagesHelper
# next line is important due to XSS! (h is rail's make_html_safe-function)
message = h(message).html_safe
message.gsub!(/( |^)(www\.[^ ]+\.[^ ])/, '\1http://\2')
- message.gsub!(/( |^)http:\/\/www\.youtube\.com\/watch[^ ]*v=([A-Za-z0-9_]+)/, '\1youtube.com::\2')
- message.gsub!(/(http|ftp):\/\/([^ ]+)/, '\2')
+ message.gsub!(/( |^)http:\/\/www\.youtube\.com\/watch[^ ]*v=([A-Za-z0-9_]+)(&[^ ]*|)/, '\1youtube.com::\2')
+ message.gsub!(/(https|http|ftp):\/\/([^ ]+)/, '\2')
while youtube = message.match(/youtube\.com::([A-Za-z0-9_]+)/)
videoid = youtube[1]
diff --git a/spec/helpers/status_messages_helper_spec.rb b/spec/helpers/status_messages_helper_spec.rb
index c0f7c1e38..0fe896ba6 100644
--- a/spec/helpers/status_messages_helper_spec.rb
+++ b/spec/helpers/status_messages_helper_spec.rb
@@ -17,7 +17,7 @@ describe StatusMessagesHelper do
it "should recognize basic http links (2/3)" do
proto="http"
- url="www.youtube.com/watch?v=b15yaPYNDRU"
+ url="webmail.example.com?~()!*/"
make_links(proto+"://"+url).should == ""+url+""
end
@@ -26,7 +26,22 @@ describe StatusMessagesHelper do
url="127.0.0.1:3000/users/sign_in"
make_links(proto+"://"+url).should == ""+url+""
end
-
+
+ it "should recognize secure https links" do
+ proto="https"
+ url="127.0.0.1:3000/users/sign_in"
+ make_links(proto+"://"+url).should == ""+url+""
+ end
+
+# this will not work because the make_links requires an internet connection, which is disabled for the test :(
+# it "should recognize youtube links" do
+# proto="http"
+# url="www.youtube.com/watch?v=UNgOJDL9iyQ&a=GxdCwVVULXdvEBKmx_f5ywvZ0zZHHHDU&list=ML&playnext=1"
+# res = make_links(proto+"://"+url, true)
+# puts "RES: " + res
+# res.should == ""+url+""
+# end
+
it "should recognize basic ftp links" do
proto="ftp"
url="ftp.uni-kl.de/CCC/26C3/mp4/26c3-3540-en-a_hackers_utopia.mp4"