Baraka
Chevereto Member
Just wanted to report a small issue with the API well its not technically the api but i was just testing the api and noticed when doing a URL upload i.e : http://mysite.com/api/1/upload/?key...ttps://www.google.com/images/srpr/logo11w.png
it would output
{"status_code":400,"error":{"message":"SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'image_nsfw' cannot be null","code":400,"context":"CHV\\ImageException"},"status_txt":"Bad Request"}
So i had a look at the CHV\Image class towards ::uploadToWebsite and noticed on line 542 via $params['nsfw'] its just set as that so it can't be NULL as in the table's structure its looking for a int() or in this case a tinyint so what i did to fix it was used a ternary operator; changed
$params['nsfw'] to :
and all is good now and i am not sure if its the same if the source is a normal file uploaded in a form as i haven't tested it but yeah
it would output
{"status_code":400,"error":{"message":"SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'image_nsfw' cannot be null","code":400,"context":"CHV\\ImageException"},"status_txt":"Bad Request"}
So i had a look at the CHV\Image class towards ::uploadToWebsite and noticed on line 542 via $params['nsfw'] its just set as that so it can't be NULL as in the table's structure its looking for a int() or in this case a tinyint so what i did to fix it was used a ternary operator; changed
$params['nsfw'] to :
PHP:
($params['nsfw']) ? $params['nsfw'] : 0
and all is good now and i am not sure if its the same if the source is a normal file uploaded in a form as i haven't tested it but yeah