datopian / ckanext-blob-storage

CKAN extension to offload blob storage to cloud storage providers (S3, GCS, Azure etc).
http://tech.datopian.com/blob-storage/
MIT License
14 stars 6 forks source link

Storage fields validators #51

Closed pdelboca closed 3 years ago

pdelboca commented 3 years ago

sha256, size and lfs_prefix attributes are key to be able to download correctly so we need to validate they're being set correctly when creating a resource via UI or API.

Nowadays all the logic and validation is in the FronEnd, this will move the logic to the backed so API users can also have a validation.

Note: the creation and the structure of the lfs_prefix depends on each instance so I'm just validating that the field exist in the resource schema. Let me know your thoughts!

shevron commented 3 years ago

Re lfs_prefix it kind of makes sense to create it on the server side, but it also doesn't - the uploading client should set it after doing the upload, after all the server isn't uploading. I'm thinking that maybe the right solution would be an endpoint that provides the "right" lfs_prefix, along with the LFS server URL and an auth token. This can be used by API clients to upload and then set the right prefix. I'm not sure about this. What do you think?