Fixed some stuff from PR #13208 feedback:

- HTTPException is already imported
- same-value-assignment not needed
This commit is contained in:
Roland Häder 2023-06-09 22:19:48 +02:00
parent 993d45d2f5
commit 818a7fb451
No known key found for this signature in database
GPG Key ID: C82EDE5DDFA0BA77
2 changed files with 8 additions and 12 deletions

View File

@ -341,12 +341,10 @@ class Probe
* @param string $uri Address that should be probed * @param string $uri Address that should be probed
* @param string $network Test for this specific network * @param string $network Test for this specific network
* @param integer $uid User ID for the probe (only used for mails) * @param integer $uid User ID for the probe (only used for mails)
* @param boolean $cache Use cached values?
* *
* @return array uri data * @return array uri data
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
* @throws \ImagickException * @throws \ImagickException
* @todo Choice: implement $cache parameter or remove documentation
*/ */
public static function uri(string $uri, string $network = '', int $uid = -1): array public static function uri(string $uri, string $network = '', int $uid = -1): array
{ {

View File

@ -42,7 +42,6 @@ use Friendica\Model\Tag;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Network\HTTPClient\Client\HttpClientAccept; use Friendica\Network\HTTPClient\Client\HttpClientAccept;
use Friendica\Network\HTTPException; use Friendica\Network\HTTPException;
use Friendica\Network\HTTPException\BadRequestException;
use Friendica\Network\Probe; use Friendica\Network\Probe;
use Friendica\Protocol\Delivery; use Friendica\Protocol\Delivery;
use Friendica\Util\Crypto; use Friendica\Util\Crypto;
@ -268,7 +267,7 @@ class Diaspora
if ($no_exit) { if ($no_exit) {
return false; return false;
} else { } else {
throw new BadRequestException(); throw new HTTPException\BadRequestException();
} }
} }
} else { } else {
@ -282,7 +281,7 @@ class Diaspora
if ($no_exit) { if ($no_exit) {
return false; return false;
} else { } else {
throw new BadRequestException(); throw new HTTPException\BadRequestException();
} }
} }
@ -308,7 +307,7 @@ class Diaspora
if ($no_exit) { if ($no_exit) {
return false; return false;
} else { } else {
throw new BadRequestException(); throw new HTTPException\BadRequestException();
} }
} }
@ -323,7 +322,7 @@ class Diaspora
if ($no_exit) { if ($no_exit) {
return false; return false;
} else { } else {
throw new BadRequestException(); throw new HTTPException\BadRequestException();
} }
} }
@ -333,7 +332,7 @@ class Diaspora
if ($no_exit) { if ($no_exit) {
return false; return false;
} else { } else {
throw new BadRequestException(); throw new HTTPException\BadRequestException();
} }
} }
@ -425,7 +424,7 @@ class Diaspora
if (!$base) { if (!$base) {
Logger::notice('unable to locate salmon data in xml'); Logger::notice('unable to locate salmon data in xml');
throw new BadRequestException(); throw new HTTPException\BadRequestException();
} }
@ -465,14 +464,14 @@ class Diaspora
$key = self::key($author); $key = self::key($author);
if (!$key) { if (!$key) {
Logger::notice('Could not retrieve author key.'); Logger::notice('Could not retrieve author key.');
throw new BadRequestException(); throw new HTTPException\BadRequestException();
} }
$verify = Crypto::rsaVerify($signed_data, $signature, $key); $verify = Crypto::rsaVerify($signed_data, $signature, $key);
if (!$verify) { if (!$verify) {
Logger::notice('Message did not verify. Discarding.'); Logger::notice('Message did not verify. Discarding.');
throw new BadRequestException(); throw new HTTPException\BadRequestException();
} }
Logger::info('Message verified.'); Logger::info('Message verified.');
@ -2686,7 +2685,6 @@ class Diaspora
$datarray['object-type'] = Activity\ObjectType::IMAGE; $datarray['object-type'] = Activity\ObjectType::IMAGE;
$datarray['post-type'] = Item::PT_IMAGE; $datarray['post-type'] = Item::PT_IMAGE;
} elseif ($data->poll) { } elseif ($data->poll) {
$datarray['object-type'] = Activity\ObjectType::NOTE;
$datarray['post-type'] = Item::PT_POLL; $datarray['post-type'] = Item::PT_POLL;
} }