We've been noticing that every so often an avatar file is deleted from the file system. I think I've finally tracked down how and why.

1. This only occurs when you have multiple pages of avatars.
2. Select an avatar from avatar selection, set it as your picture, and save your profile.
3. Choose an avatar selection page that does NOT contain your currently selected avatar.
4. Upload an image.
5. The image file that was your previous (avatar-selection) image will be deleted.

I'm pretty sure that the issues lies with the test on line 289 of avatar_selection.module (version 6.x-1.6):

      if (array_key_exists($current_avatar, $selects['avatars'])) {
        $form['_account']['#value']->picture = NULL;

The problem is that $selects only contains those avatars from the current page so line 290 won't be run and the user.module code will delete the image.

Is there any reason we can't do away with this block and move line 290 into the test on lines 300 and 301? It seems like that's what we're trying to accomplish.


stella’s picture

Assigned: Unassigned » stella
Priority: Normal » Critical
stella’s picture

Status: Active » Fixed

Fixed! Thank you!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.