forked from GNUsocial/gnu-social
Notice->getUrl() for shares would throw exception in some feeds
This commit is contained in:
parent
ce23c68d1c
commit
04b7194511
@ -1493,7 +1493,12 @@ class Notice extends Managed_DataObject
|
|||||||
|
|
||||||
$act->id = $this->uri;
|
$act->id = $this->uri;
|
||||||
$act->time = strtotime($this->created);
|
$act->time = strtotime($this->created);
|
||||||
|
try {
|
||||||
$act->link = $this->getUrl();
|
$act->link = $this->getUrl();
|
||||||
|
} catch (InvalidUrlException $e) {
|
||||||
|
// The notice is probably a share or similar, which don't
|
||||||
|
// have a representational URL of their own.
|
||||||
|
}
|
||||||
$act->content = common_xml_safe_str($this->rendered);
|
$act->content = common_xml_safe_str($this->rendered);
|
||||||
|
|
||||||
$profile = $this->getProfile();
|
$profile = $this->getProfile();
|
||||||
|
@ -38,6 +38,7 @@ class OembedPlugin extends Plugin
|
|||||||
'title'=>'oEmbed'),null);
|
'title'=>'oEmbed'),null);
|
||||||
break;
|
break;
|
||||||
case 'shownotice':
|
case 'shownotice':
|
||||||
|
try {
|
||||||
$action->element('link',array('rel'=>'alternate',
|
$action->element('link',array('rel'=>'alternate',
|
||||||
'type'=>'application/json+oembed',
|
'type'=>'application/json+oembed',
|
||||||
'href'=>common_local_url(
|
'href'=>common_local_url(
|
||||||
@ -52,6 +53,10 @@ class OembedPlugin extends Plugin
|
|||||||
array(),
|
array(),
|
||||||
array('format'=>'xml','url'=>$action->notice->getUrl())),
|
array('format'=>'xml','url'=>$action->notice->getUrl())),
|
||||||
'title'=>'oEmbed'),null);
|
'title'=>'oEmbed'),null);
|
||||||
|
} catch (InvalidUrlException $e) {
|
||||||
|
// The notice is probably a share or similar, which don't
|
||||||
|
// have a representational URL of their own.
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user