Fix up catching of webfinger setup fails
This commit is contained in:
parent
6a5a629afa
commit
a4d9171306
@ -260,7 +260,7 @@ class OStatusSubAction extends Action
|
|||||||
$this->error = _m('Could not find a feed linked from this URL.');
|
$this->error = _m('Could not find a feed linked from this URL.');
|
||||||
} catch (FeedSubUnrecognizedTypeException $e) {
|
} catch (FeedSubUnrecognizedTypeException $e) {
|
||||||
$this->error = _m('Not a recognized feed type.');
|
$this->error = _m('Not a recognized feed type.');
|
||||||
} catch (FeedSubException $e) {
|
} catch (Exception $e) {
|
||||||
// Any new ones we forgot about
|
// Any new ones we forgot about
|
||||||
$this->error = sprintf(_m('Bad feed URL: %s %s'), get_class($e), $e->getMessage());
|
$this->error = sprintf(_m('Bad feed URL: %s %s'), get_class($e), $e->getMessage());
|
||||||
}
|
}
|
||||||
@ -315,7 +315,6 @@ class OStatusSubAction extends Action
|
|||||||
if ($this->pullRemoteProfile()) {
|
if ($this->pullRemoteProfile()) {
|
||||||
$this->validateRemoteProfile();
|
$this->validateRemoteProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1267,6 +1267,11 @@ class Ostatus_profile extends Memcached_DataObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $addr webfinger address
|
||||||
|
* @return Ostatus_profile
|
||||||
|
* @throws Exception on error conditions
|
||||||
|
*/
|
||||||
public static function ensureWebfinger($addr)
|
public static function ensureWebfinger($addr)
|
||||||
{
|
{
|
||||||
// First, try the cache
|
// First, try the cache
|
||||||
@ -1275,7 +1280,8 @@ class Ostatus_profile extends Memcached_DataObject
|
|||||||
|
|
||||||
if ($uri !== false) {
|
if ($uri !== false) {
|
||||||
if (is_null($uri)) {
|
if (is_null($uri)) {
|
||||||
return null;
|
// Negative cache entry
|
||||||
|
throw new Exception('Not a valid webfinger address.');
|
||||||
}
|
}
|
||||||
$oprofile = Ostatus_profile::staticGet('uri', $uri);
|
$oprofile = Ostatus_profile::staticGet('uri', $uri);
|
||||||
if (!empty($oprofile)) {
|
if (!empty($oprofile)) {
|
||||||
@ -1299,8 +1305,9 @@ class Ostatus_profile extends Memcached_DataObject
|
|||||||
try {
|
try {
|
||||||
$result = $disco->lookup($addr);
|
$result = $disco->lookup($addr);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
// Save negative cache entry so we don't waste time looking it up again.
|
||||||
self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), null);
|
self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), null);
|
||||||
return null;
|
throw new Exception('Not a valid webfinger address.');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($result->links as $link) {
|
foreach ($result->links as $link) {
|
||||||
@ -1410,7 +1417,7 @@ class Ostatus_profile extends Memcached_DataObject
|
|||||||
return $oprofile;
|
return $oprofile;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
throw new Exception("Couldn't find a valid profile for '$addr'");
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveHTMLFile($title, $rendered)
|
function saveHTMLFile($title, $rendered)
|
||||||
|
Loading…
Reference in New Issue
Block a user