inveniosoftware / invenio-records-resources

Records REST APIs for Invenio.
https://invenio-records-resources.readthedocs.io
MIT License
4 stars 49 forks source link

[file] commit response returns size as a float #170

Closed fenekku closed 2 years ago

fenekku commented 3 years ago

Package version (if known): november release

After committing file upload, I get:

{
    "mimetype": "image/jpeg",
    "status": "completed",
    "bucket_id": "1ac3d7d9-1302-4b93-bb30-9b16dabbca0f",
    "links": {
        "self": "https://127.0.0.1:5000/api/records/b0tr1-x3r31/draft/files/leaf_doge.jpg",
        "commit": "https://127.0.0.1:5000/api/records/b0tr1-x3r31/draft/files/leaf_doge.jpg/commit",
        "content": "https://127.0.0.1:5000/api/records/b0tr1-x3r31/draft/files/leaf_doge.jpg/content"
    },
    "updated": "2020-12-01 20:23:41.808082",
    "file_id": "1c30c558-0610-4873-9c5b-169f5424754e",
    "key": "leaf_doge.jpg",
    "created": "2020-12-01 19:56:38.159707",
    "checksum": "md5:f609873ed7e830497933ed9e4838634c",
    "version_id": "ac99a2c8-0cc3-440d-bacf-de58aac2f53f",
    "size": 955828.0,
    "storage_class": "S",
    "metadata": null
}

where size has a decimal point. That shouldn't be the case.

ppanero commented 3 years ago

https://github.com/inveniosoftware/invenio-records-resources/blob/master/invenio_records_resources/services/files/schema.py#L35 The schema sets it as Number, should be Integer.

Worth adding a test checking it? (e.g. dump and str(size_field_test) and regex that has no .0)??