Fix upload restriction

This commit is contained in:
Daniil Gentili 2019-12-29 16:30:15 +01:00
parent 8ba10b047e
commit acd66a8bc4
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 4 additions and 2 deletions

View File

@ -20,6 +20,7 @@
*/
use danog\MadelineProto\Logger;
use League\Uri\Contracts\UriException;
/*
* Various ways to load MadelineProto
@ -141,7 +142,7 @@ class EventHandler extends \danog\MadelineProto\EventHandler
yield $this->messages->deleteMessages(['revoke' => true, 'id' => [$id]]);
}
} catch (\Throwable $e) {
if (\strpos($e->getMessage(), 'Could not connect to URI') === false) {
if (\strpos($e->getMessage(), 'Could not connect to URI') === false && !($e instanceof UriException)) {
$this->report((string) $e);
$this->logger((string) $e, \danog\MadelineProto\Logger::FATAL_ERROR);
}

View File

@ -70,7 +70,8 @@ trait Files
}
} elseif (\is_array($file)) {
return yield $this->uploadFromTgfile($file, $cb, $encrypted);
} elseif (!$this->API->settings['upload']['allow_automatic_upload']) {
}
if (!$this->settings['upload']['allow_automatic_upload']) {
return yield $this->uploadFromUrl($file, 0, $fileName, $cb, $encrypted);
}