Unable to post email address

AI 生成的摘要

The discussion revolves around the inability to post email addresses, resulting in an Error 500. gerhard initially suspects it’s related to PR 4138, but sam identifies it as a regression in extract links, causing a NoMethodError. zogstrip investigates and eventually confirms gerhard’s suspicion, fixing the issue with a commit.

It’s not possible to post an email address anymore. The following produces an Error 500:

  • [foo@example.com](http://foo@example.com)
  • [email]bar@example.com[/email]

This seems to be related to PR 4138.

parsed.path seems to be nil for email addresses. Does it even make sense to parse URIs with a scheme other than http and https?

3 个赞

Nahh not that, its a regression in extract links

NoMethodError (undefined method `slice!' for nil:NilClass)

/var/www/discourse/app/models/topic_link.rb:129:in `block (2 levels) in extract_from'
/var/www/discourse/app/models/topic_link.rb:116:in `each'
/var/www/discourse/app/models/topic_link.rb:116:in `block in extract_from'
/var/www/discourse/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/var/www/discourse/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:220:in `transaction'
/var/www/discourse/app/models/topic_link.rb:106:in `extract_from'
/var/www/discourse/lib/post_creator.rb:385:in `extract_links'

I think @eviltrout fixed some bugs there recently … not sure.

1 个赞

Actually, I might have introduced that bug. Having a look.

3 个赞

@gerhard was right after all :wink:

https://github.com/discourse/discourse/commit/f38289795250f84fb2cb7e81ed0037780c08f7fc

4 个赞