Server error with handcrafted mailto: link


(Michael Brown) #1

The following handcrafted link makes Discourse puke and die with a 500 on posting:

Michael Brown [<michael.brown@discourse.org>](mailto:michael.brown@discourse.org?subject=Your%20post%20at%20http://try.discourse.org/t/discussion-happens-so-much/127/1000?u=supermathie)

(Sam Saffron) #2

Michael Brown <michael.brown@discourse.org>

hmmm

testing


(Sam Saffron) #3

We are no longer getting 500s … now adding support for mailto links is in the feature request department :slight_smile: there are plenty of concerns there cause you would only want to allow admins/mods to add these things.


(Sam Saffron) #6

Aha, the error happens later on:

/usr/local/lib/ruby/2.0.0/uri/mailto.rb:150:in `initialize'
/usr/local/lib/ruby/2.0.0/uri/common.rb:214:in `new'
/usr/local/lib/ruby/2.0.0/uri/common.rb:214:in `parse'
/usr/local/lib/ruby/2.0.0/uri/common.rb:747:in `parse'
/usr/local/lib/ruby/2.0.0/uri/common.rb:996:in `URI'
/var/www/discourse/lib/pretty_text.rb:263:in `block in make_all_links_absolute'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/nokogiri-1.6.2.1/lib/nokogiri/xml/node_set.rb:237:in `block in each'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/nokogiri-1.6.2.1/lib/nokogiri/xml/node_set.rb:236:in `upto'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/nokogiri-1.6.2.1/lib/nokogiri/xml/node_set.rb:236:in `each'
/var/www/discourse/lib/pretty_text.rb:260:in `make_all_links_absolute'
/var/www/discourse/lib/pretty_text.rb:278:in `format_for_email'
/var/www/discourse/app/helpers/user_notifications_helper.rb:71:in `cooked_post_for_email'
unrecognised opaque part for mailtoURL: michael.brown@discourse.org?subject=Your%20post%20at%20http://try.discourse.org/t/discussion-happens-so-much/127/1000?u=supermathie

Looks fairly straight forward to fix


(Sam Saffron) #7

Should be fixed by:

https://github.com/discourse/discourse/commit/84836944e85c64a6cc965ccc1d3fe0b08462659c


(Sam Saffron) #8