diff --git a/.woodpecker/.test.yml b/.woodpecker/.test.yml index 7b4b4601e..6dae8d2e2 100644 --- a/.woodpecker/.test.yml +++ b/.woodpecker/.test.yml @@ -35,5 +35,5 @@ steps: - TAG=${CI_COMMIT_TAG} commands: - apk add bash + - tests/test.sh - php tests/handshake.php - - tests/test.sh \ No newline at end of file diff --git a/src/MTProtoSession/CallHandler.php b/src/MTProtoSession/CallHandler.php index 8592573c3..3438167db 100644 --- a/src/MTProtoSession/CallHandler.php +++ b/src/MTProtoSession/CallHandler.php @@ -115,7 +115,8 @@ trait CallHandler $aargs['datacenter'] = $args['id']['dc_id']; return $this->API->methodCallAsyncWrite($method, $args, $aargs); } - if (($aargs['file'] ?? false) && !$this->isMedia() && $this->API->datacenter->has(-$this->datacenter)) { + $file = \in_array($method, ['upload.saveFilePart', 'upload.saveBigFilePart', 'upload.getFile', 'upload.getCdnFile'], true); + if ($file && !$this->isMedia() && $this->API->datacenter->has(-$this->datacenter)) { $this->logger->logger('Using media DC'); $aargs['datacenter'] = -$this->datacenter; return $this->API->methodCallAsyncWrite($method, $args, $aargs); @@ -181,7 +182,7 @@ trait CallHandler if (isset($aargs['msg_id'])) { $message->setMsgId($aargs['msg_id']); } - if ($aargs['file'] ?? false) { + if ($file) { $message->setFileRelated(true); } if ($aargs['botAPI'] ?? false) { diff --git a/src/MTProtoTools/Files.php b/src/MTProtoTools/Files.php index 8115a0657..964aba5be 100644 --- a/src/MTProtoTools/Files.php +++ b/src/MTProtoTools/Files.php @@ -291,7 +291,7 @@ trait Files $this->methodCallAsyncWrite(...), $method, fn () => $callable($part_num), - ['heavy' => true, 'file' => true, 'datacenter' => &$datacenter] + ['heavy' => true, 'datacenter' => &$datacenter] ); if (!$seekable) { try { @@ -1133,7 +1133,7 @@ trait Files $res = $this->methodCallAsyncRead( $cdn ? 'upload.getCdnFile' : 'upload.getFile', $basic_param + $offset, - ['heavy' => true, 'file' => true, 'FloodWaitLimit' => 0, 'datacenter' => &$datacenter, 'postpone' => $postpone] + ['heavy' => true, 'FloodWaitLimit' => 0, 'datacenter' => &$datacenter, 'postpone' => $postpone] ); break; } catch (FloodWaitError $e) { @@ -1186,7 +1186,7 @@ trait Files $datacenter = 0; } while ($cdn === false && $res['type']['_'] === 'storage.fileUnknown' && $res['bytes'] === '' && $this->datacenter->has(++$datacenter)) { - $res = $this->methodCallAsyncRead('upload.getFile', $basic_param + $offset, ['heavy' => true, 'file' => true, 'FloodWaitLimit' => 0, 'datacenter' => $datacenter]); + $res = $this->methodCallAsyncRead('upload.getFile', $basic_param + $offset, ['heavy' => true, 'FloodWaitLimit' => 0, 'datacenter' => $datacenter]); } $res['bytes'] = (string) $res['bytes']; if ($res['bytes'] === '') {