1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-26 21:14:43 +01:00

Fix validation

This commit is contained in:
Daniil Gentili 2023-08-20 22:31:45 +02:00
parent f59edfaa53
commit ee760ce3f4
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
4 changed files with 11 additions and 8 deletions

@ -1 +1 @@
Subproject commit 7ad64fad1b8a33e3cb7f6b15e9d9e70dfe7b7bd5
Subproject commit af1848cae0e3b9d0c0c9a73e0b080f9d5714b14e

View File

@ -398,9 +398,9 @@ final class Magic
return self::$canConvert;
}
try {
Ogg::convert(new ReadableBuffer("\0"), new WritableBuffer);
Ogg::convert(new LocalFile(__DIR__.'/empty.wav'), new WritableBuffer);
self::$canConvert = true;
} catch (\Throwable) {
} catch (\Throwable $e) {
self::$canConvert = false;
}
return self::$canConvert;

View File

@ -544,11 +544,14 @@ final class Ogg
{
$ok = false;
try {
$cancel = new DeferredCancellation;
$ogg = new self($f, $cancel->getCancellation());
$ok = \in_array('MADELINE_ENCODER_V=1', $ogg->comments, true);
} catch (\Throwable) {
}
try {
$cancel = new DeferredCancellation;
$ogg = new self($f, $cancel->getCancellation());
$ok = \in_array('MADELINE_ENCODER_V=1', $ogg->comments, true);
} finally {
$cancel->cancel();
}
} catch (\Throwable) {}
if (!$ok) {
throw new AssertionError("The passed file was not generated by MadelineProto or @libtgvoipbot, please pre-convert it using @libtgvoip bot or install FFI and ffmpeg to perform realtime conversion!");
}

BIN
src/empty.wav Normal file

Binary file not shown.