Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
701 views
in Technique[技术] by (71.8m points)

python - Variable downloaded file size in a flask website

I generate an .odt file in a flask app using something like :

return send_file( # imported from flask
    BytesIO(data), # importe from stdlib
    attachment_filename=filename,
    as_attachment=True
)

On my machine with Ubuntu using either Firefox or Chromium, I download the file fine. It opens like a breathe.

On another machine, on the same wired network but using a corporate windows setup and still Firefox, the file is missing bytes. The file size varies from download to download without any clear pattern, and is about 100/200ko smaller.

I tried with curl on said machine, and got the same results with missing bytes.

The server is a python 3.6 flask 0.12 powered website on a debian with gunicorn + nginx.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I found the problem: the machines where it doesn't work are the ones with kaspersky installed. If you disable it, the bytes are here. Now I have to find a way to tell the AV I'm not evil. I opened another question about it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...