You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(filer): HTTP(S) uploads read outputs in text mode, so binary files fail and some text is altered #215
Decoding the file, and then encoding the string again for the request (http.client encodes a str body as Latin-1), rejects or changes anything that isn't plain ASCII with LF line endings. The deployed filer image docker.io/elixircloud/tesk-core-filer:v0.10.2, the one charts/tesk/values.yaml uses, has the same code.
Reproduction
I ran HTTPTransput(path, url, Type.File).upload_file() inside elixircloud/tesk-core-filer:v0.10.2 (Python 3.7.10, requests 2.31.0) against a local server that saves each PUT body:
File
upload_file()
Bytes received
ASCII text
returns 0
identical
gzip
raises UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1
nothing
UTF-8 café
returns 0
é arrives as Latin-1 (c3 a9 became e9)
UTF-8 x ≥ 1
raises UnicodeEncodeError: 'latin-1' codec can't encode character '≥'
nothing
CRLF text
returns 0
CRLF arrives as LF
So binary outputs (BAM, gzip, images) can't be uploaded over HTTP(S). Two kinds of text output are uploaded altered while the upload reports success.
Proposed fix
Open the file in binary mode and pass the file object, so it's sent byte for byte and streamed instead of read into memory:
requests sets Content-Length from the file size. The b'' case matters: for an empty file object requests falls back to Transfer-Encoding: chunked, which S3-style presigned upload URLs reject. In the same image, this version uploaded all five files above plus an empty file byte for byte, each with a Content-Length and no chunked encoding. Passing the file object alone sent the empty file chunked.
Related: download_file holds the whole response in memory (req.content); stream=True with iter_content would avoid that.
#179 plans a filer redesign. This is a bug in the code deployed today, so it seems worth fixing in place first. I'm happy to send a PR.
Context: we use TES HTTP(S) outputs with presigned or redirecting upload URLs, so TES nodes need no credentials for the client's storage. calypr/funnel#1471 covers the same capability in Funnel.
Activity
anuragxxd commentedon Oct 23, 2026
@uniqueg what do you think about this?
uniqueg commentedon Oct 23, 2026
Go for it :)