This commit is contained in:
Daniil Gentili 2017-02-17 22:36:16 +01:00
parent 8358a58839
commit 3ceb34c3b0
3 changed files with 5 additions and 4 deletions

View File

@ -28,7 +28,7 @@ class Exception extends \Exception
if (\danog\MadelineProto\Logger::$constructed) {
\danog\MadelineProto\Logger::log([$errstr.' in '.basename($errfile).':'.$errline], \danog\MadelineProto\Logger::FATAL_ERROR);
}
$e = new \danog\MadelineProto\Exception($errstr, $errno);
$e = new self($errstr, $errno);
$e->file = $errfile;
$e->line = $errline;
throw $e;

View File

@ -180,13 +180,13 @@ trait PeerHandler
}
if (preg_match('/^channel#/', $id)) {
$id = str_replace('channel#', '-100', $id);
$id = preg_replace('|\D+|', '-100', $id);
}
if (preg_match('/^chat#/', $id)) {
$id = str_replace('chat#', '-', $id);
$id = preg_replace('|\D+|', '-', $id);
}
if (preg_match('/^user#/', $id)) {
$id = str_replace('user#', '', $id);
$id = preg_replace('|\D+|', '', $id);
}
if (is_numeric($id)) {

View File

@ -419,6 +419,7 @@ trait Extension
{
$this->switch_dc($location['dc_id']);
$res = $this->method_call('upload.getFile', ['location' => $location, 'offset' => 0, 'limit' => 1], ['heavy' => true]);
if (!isset($res['type']['_'])) return $default;
switch ($res['type']['_']) {
case 'storage.fileJpeg': return '.jpg';
case 'storage.fileGif': return '.gif';