Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downloading .exe causes network failure/incomplete file error message in the browser #316

Closed
kolucciy opened this issue Jan 24, 2023 · 6 comments

Comments

@kolucciy
Copy link

kolucciy commented Jan 24, 2023

I'm using Docker and It seems that the Content-Length: header is larger than the actual file size.

Uploaded file: 05fda7a3-93ca-4303-afde-d114d2448859.exe

size in asset table in Postgres = 96881664
actual size on disk = 96881664

Content-Length: 96881700

also if I log https://github.com/ArekSredzki/electron-release-server/blob/master/api/services/AssetService.js#L29 it shows 96881700

Could that be some sort of a rounding happening somewhere?

The above problem is causing the download to fail if accessed over https, or restart if accessed over http.

Workaround that fixes the problem, is to comment out this line: res.setHeader('Content-Length', asset.size);

UPDATE: Same problem when downloading the update System.Exception: Checksummed file size doesn't match, so it must be something to do with rounding.

size in asset table in Postgres = 96107536
size in RELEASES file = 96107500
@kolucciy
Copy link
Author

kolucciy commented Jan 24, 2023

Problem is related to the data type of the size field in asset table.

More info on the problem: hasura/graphql-engine#5092

It needs to be float8 and not float4, once changed to float8 the problem is gone.

@ArekSredzki
Copy link
Owner

Thanks for the ticket and your investigation!

@ArekSredzki
Copy link
Owner

Was your Postgres table created manually or by sails?

@kolucciy
Copy link
Author

I started the docker containers using docker-compose and the tables were created automatically.

@ArekSredzki
Copy link
Owner

Thanks, I'll make a change to ensure that the correct precision is used. This shouldn't be a floating point field anyway

@kolucciy
Copy link
Author

Thank you! Same for the download_count field.

ArekSredzki added a commit that referenced this issue Jan 24, 2023
WaterlineJS defaults to using floating point field types for number
fields. The causes precision issues for file sizes since the reported
file sizes do not match the assets. This would also prevent the download
count tracking to work once the count is high enough such that one
download is beyond the supported precision.

Note: users must update their existing database schemas to avoid these
issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants