browse-everything icon indicating copy to clipboard operation
browse-everything copied to clipboard

Include content-type and size in JSON response

Open jrochkind opened this issue 6 years ago • 0 comments

For drivers where the content-type and size are available without any additional HTTP requests, it would be nice to include them in the JSON response. And document these as standard keys returned by the JSON response.

Use case: The hyrax "upload" pane ordinarily lists both filename and size for files you have queued for attachment on form submit. But for browse-everything files, it can only list filename, because browse-everything doesn't reveal the size in the JSON response, thus the JS code adding lines to the list of files doens't know it to put it there.

One can also imagine a UI that wanted to list content-type as well as size.

I suspect many of the relevant driver APIs have access to this info, it just needs to be included in JSON response.

I tried to start on a PR to do it for the S3 driver, where I believe the S3 api/sdk provides access to this with the API requests already being done by b-e not requiring any additional requests... but I ran into trouble with the tests and the way S3 is being mocked in tests. I could have figured out how to get the S3 mock to support it, but I wasn't totally sure it would actually match the real S3, and wasn't sure how to be sure, so I just lost steam.

If any one driver were enhanced to do this, and it was documented what the keys should be (eg size vs file_size or content_length or whatever), that'd probably be a start, every driver wouldn't necessarily need to be enhanced to do a release with one/some of them.

This is obviously not urgent, just leaving it here to record the idea and possibly get feedback.

jrochkind avatar Nov 19 '18 22:11 jrochkind