Fix Upload Field Condition
fix(dev): FieldStorage support;
- Added condition to check for
fileattribute from FieldStorage object forckanapisupport.
CKANAPI uses cgi.FieldStorage (https://github.com/ckan/ckanapi/blob/master/ckanapi/localckan.py#L67) as to not require a lot of dependencies. Related issue on cgi.FieldStorage: https://bugs.python.org/issue19097
To support all py versions and cgi dependency versions, just checking for the file attribute might be good enough?
We've seen situations before where the FileStorage object exists but is blank, and it's necessary to further check that it has a truthy filename.
@ThrawnCA reckon I should add the filename attribute condition after the new file one? Or just replace the new file condition with filename?
Offhand I'm not sure whether testing file and testing filename are interchangeable.
@ThrawnCA good enough for me! haha, I have added the filename condition in the case that the file attribute of a File like object is empty, but there is a filename. Should still get queued for validation and then the validation will fail and tell the user that their file is empty. This make sense to me