Commit e0e69ddd authored by mmn's avatar mmn

Throw exception when we can't get the url for a notice

parent 7025817c
......@@ -213,7 +213,15 @@ class Notice extends Managed_DataObject
public function getUrl()
{
// The risk is we start having empty urls and non-http uris...
return $this->url ?: $this->uri;
// and we can't really handle any other protocol right now.
switch (true) {
case common_valid_http_url($this->url):
return $this->url;
case common_valid_http_url($this->uri):
return $this->uri;
default:
throw new ServerException('No URL available for notice.');
}
}
public function get_object_type($canonical=false) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment