{"action":"created","issue":{"url":"https://api.github.com/repos/girder/girder/issues/961","labels_url":"https://api.github.com/repos/girder/girder/issues/961/labels{/name}","comments_url":"https://api.github.com/repos/girder/girder/issues/961/comments","events_url":"https://api.github.com/repos/girder/girder/issues/961/events","html_url":"https://github.com/girder/girder/issues/961","id":105427381,"number":961,"title":"Add API endpoint for content-addressed downloads","user":{"login":"mathstuf","id":97253,"avatar_url":"https://avatars.githubusercontent.com/u/97253?v=3","gravatar_id":"","url":"https://api.github.com/users/mathstuf","html_url":"https://github.com/mathstuf","followers_url":"https://api.github.com/users/mathstuf/followers","following_url":"https://api.github.com/users/mathstuf/following{/other_user}","gists_url":"https://api.github.com/users/mathstuf/gists{/gist_id}","starred_url":"https://api.github.com/users/mathstuf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mathstuf/subscriptions","organizations_url":"https://api.github.com/users/mathstuf/orgs","repos_url":"https://api.github.com/users/mathstuf/repos","events_url":"https://api.github.com/users/mathstuf/events{/privacy}","received_events_url":"https://api.github.com/users/mathstuf/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/girder/girder/labels/feature","name":"feature","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-08T17:07:32Z","updated_at":"2016-01-22T21:20:28Z","closed_at":null,"body":"Midas allows one to download using `&checksum=$hash&algorithm=$algo`. It would be nice to have such content-addressed download URLs for girder as well (something like `item/content/{algo}/{hash}/download`?).\r\n\r\nThese URLs are used for VTK's data store downloading (where the `{id}` of the file is not necessarily known).\r\n\r\nOf course, if there is a better way, I'm willing to be enlightened :) ."},"comment":{"url":"https://api.github.com/repos/girder/girder/issues/comments/174052312","html_url":"https://github.com/girder/girder/issues/961#issuecomment-174052312","issue_url":"https://api.github.com/repos/girder/girder/issues/961","id":174052312,"user":{"login":"brianhelba","id":1282879,"avatar_url":"https://avatars.githubusercontent.com/u/1282879?v=3","gravatar_id":"","url":"https://api.github.com/users/brianhelba","html_url":"https://github.com/brianhelba","followers_url":"https://api.github.com/users/brianhelba/followers","following_url":"https://api.github.com/users/brianhelba/following{/other_user}","gists_url":"https://api.github.com/users/brianhelba/gists{/gist_id}","starred_url":"https://api.github.com/users/brianhelba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianhelba/subscriptions","organizations_url":"https://api.github.com/users/brianhelba/orgs","repos_url":"https://api.github.com/users/brianhelba/repos","events_url":"https://api.github.com/users/brianhelba/events{/privacy}","received_events_url":"https://api.github.com/users/brianhelba/received_events","type":"User","site_admin":false},"created_at":"2016-01-22T21:20:28Z","updated_at":"2016-01-22T21:20:28Z","body":"I have a need for this now, and after discussing it with @jbeezley , I'm planning to implement this as a plugin where:\r\n* Upon upload of a file to any non-S3 assetstore type, the plugin will hash the file with all of the algorithms that [CMake ExternalData supports](https://cmake.org/cmake/help/v3.3/module/ExternalData.html#hash-algorithms).\r\n * Since non-proxied uploads to S3 never give Girder direct custody of the file's binary data, we can't guarantee full support for S3 assetstores. However, if a proxied S3 upload takes case, the plugin should hash the content. Finally, note that it's possible to [get the MD5 (but not other hashes) of a file in S3 without downloading it](http://stackoverflow.com/questions/1775816/how-to-get-the-md5sum-of-a-file-on-amazons-s3)\r\n * Generating multiple hash types shouldn't be too much more expensive, since we can have multiple stateful hash variables, each of which is updated as the file is iterated through once.\r\n* The file may be downloaded via a ``/api/v1/file/content/{algo}/{hash}/download`` URL.\r\n * I don't have a strong opinion about the syntax of this URL, so chime in if you have a better idea.\r\n* At first, this plugin will not support access to files that were uploaded before the plugin was enabled.\r\n* The plugin will be enabled for all files globally.\r\n * I don't really understand the need to only enable this on a per-collection basis. Feel free to present a use case that requires this, however."}}