2 Commits
Author SHA1 Message Date
asepharyana 9743fbf4b7 chore(release): bump teleuploader 1.1.0 -> 1.1.1
Force a fresh Nix store path so the Buffer-from-gzip fix actually reaches
the VPS. The 1.1.0 store path hash was reused by Nix (identical derivation
inputs from Nix's perspective), so a version bump guarantees the fixed
dist bundle is copied and the profile is switched.
2026-09-06 00:17:34 +07:00
asepharyana d296e0ebcf fix(upload): wrap gzip chunk output in Buffer so Telegraf uploads work
Root cause of '400: Bad Request: there is no document in the request' on
chunked uploads of compressible files (MP4, zip, text, etc.):
Bun.gzipSync() returns a plain Uint8Array, NOT a Buffer. Telegraf
(sendDocument/sendVideo) only recognises Buffer/Blob/stream sources as
file uploads — a plain Uint8Array produces an empty multipart body and
Telegram rejects the request.

Verified via isolated forwardToStorage probes:
- raw Buffer chunk (.bin, MP4) -> OK
- plain Uint8Array chunk -> FAIL: there is no document
- Buffer.from(gzip) chunk -> OK (after fix)
- .gz extension on Uint8Array did NOT help (rules out MIME/extension)

This only affected chunked uploads of compressible files; incompressible
files (random .bin) worked by accident because gzip didn't shrink them so
the raw Buffer was forwarded unchanged.
2026-09-06 00:11:00 +07:00
2 changed files with 9 additions and 3 deletions

No files matched your search

+1 -1
View File
@@ -27,7 +27,7 @@
# TeleUploader package
teleuploader = pkgs.stdenvNoCC.mkDerivation rec {
pname = "teleuploader";
version = "1.1.0";
version = "1.1.1";
src = ./.;
+8 -2
View File
@@ -23,10 +23,16 @@ export const maybeCompressChunk = (
return { bytes: chunk, compressionAlgorithm: null };
}
const gzipped = Bun.gzipSync(chunk);
const gzipped = Bun.gzipSync(chunk as Uint8Array<ArrayBuffer>);
if (gzipped.byteLength >= chunk.byteLength) {
return { bytes: chunk, compressionAlgorithm: null };
}
return { bytes: gzipped, compressionAlgorithm: 'gzip' };
// CRITICAL: Bun.gzipSync returns a plain Uint8Array, NOT a Buffer.
// Telegraf (telegram.sendDocument) only recognises Buffer/Blob/stream
// sources as file uploads — a plain Uint8Array yields an empty multipart
// body and Telegram rejects with "400: there is no document in the request".
// Wrap in Buffer.from(...) so chunked uploads of compressible files (MP4,
// zip, text, etc.) actually work.
return { bytes: Buffer.from(gzipped), compressionAlgorithm: 'gzip' };
};