• Welcome to the Chevereto User Community!

    Here, users from all over the world come together to learn, share, and collaborate on everything related to Chevereto. It's a place to exchange ideas, ask questions, and help improve the software.

    Please keep in mind:

    • This community is user-driven. Always be polite and respectful to others.
    • Support development by purchasing a Chevereto license, which also gives you priority support.
    • Go further by joining the Community Subscription for even faster response times and to help sustain this space
  • Chevereto Support CLST

    Support response

    Support checklist

    • Got a Something went wrong message? Read this guide and provide the actual error. Do not skip this.
    • Confirm that the server meets the System Requirements
    • Check for any available Hotfix - your issue could be already reported/fixed
    • Read documentation - It will be required to Debug and understand Errors for a faster support response

Image description and category erased on update

Status
Not open for further replies.

lonepress

Chevereto Member
This happens when images are updated via the json route with action=edit. For example, when using the "flag as unsafe" image overlay button.

The code calls Image::update(...), which calls G\nullify_string(...) on 'description' and 'category_id'. It looks like this call happens so that empty strings will be updated to null values in the database.

The problem is, if the $values array does not contain 'description' or 'category', this function adds them to the array with a null value, so the old values get erased.

I fixed it in Image::update by replacing this:
PHP:
foreach(['description', 'category_id'] as $v) {
    G\nullify_string($values[$v]);
}
with this:
PHP:
foreach(['description', 'category_id'] as $v) {
    if (array_key_exists($v, $values)) {
        G\nullify_string($values[$v]);
    }
}
 
It also looks like the same problem exists in route.json.php when editing categories (it nullifies the category description), and in Album::update(...) (it nullifies the album description). It may not be a real issue there if callers always pass a description value through those code paths, but I'm not sure of that.
 
Status
Not open for further replies.
Back
Top