# Can't generate user avatars when moving to new server because extension is "unknown"

**URL:** <https://meta.discourse.org/t/cant-generate-user-avatars-when-moving-to-new-server-because-extension-is-unknown/207134>\
**Category:** Bug\
**Created:** [October 26, 2021, 2:35pm UTC](https://meta.discourse.org/t/cant-generate-user-avatars-when-moving-to-new-server-because-extension-is-unknown/207134 "2021-10-26T14:35:36Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [October 26, 2021, 2:35pm UTC](https://meta.discourse.org/t/cant-generate-user-avatars-when-moving-to-new-server-because-extension-is-unknown/207134/1 "2021-10-26T14:35:36Z")

</div>

EDIT: I’m reclassifying this as a bug, so that someone who understands this better than I can take a look at it.

a bunch of uploads had “unknown” as the extension. This means that it’s impossible to generate thumbnails. I think this happened when moving a backup to a new site and then needed to regenerate the thumbnails.

I think what should happen when you try to generate thumbnails and the extension is ‘unknown’ is to replace the extension, something like

```
 upload.extension = upload.original_filename.split('.').last

```

It seems like if this were done somewhere that I’d not have spent 4 hours on this.

Wait. This looks like the problem. Why return `false` rather than get the extension from the filename?

> <https://github.com/discourse/discourse/blob/main/app/models/upload.rb#L151>

## Gory details follow.

I moved a site from `/community` to `community.example.com` by doing a backup and restore. I fixed the uploads with a

```
 RAILS_ENV=production bundle exec script/discourse remap '/community/uploads' '/uploads'

```

But the avatars are still the Gray Man.

When I look at `user.user_avatar.custom_upload.url` and paste that URL into the browser, I get the desired avatar. It seems like I need to “rebake” the users.

I thought that perhaps a

```
rake avatars:refresh

```

or

```
rake avatars:clean 

```

might fix it, but no joy.

What am I missing?

---

_[View the full topic](https://meta.discourse.org/t/cant-generate-user-avatars-when-moving-to-new-server-because-extension-is-unknown/207134)._
