# Rebaking posts fails when attachments aren't allowed anymore

**URL:** <https://meta.discourse.org/t/rebaking-posts-fails-when-attachments-arent-allowed-anymore/30429>\
**Category:** Support\
**Created:** [June 24, 2015, 10:20pm UTC](https://meta.discourse.org/t/rebaking-posts-fails-when-attachments-arent-allowed-anymore/30429 "2015-06-24T22:20:49Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)\
**Post date:** [June 24, 2015, 10:20pm UTC](https://meta.discourse.org/t/rebaking-posts-fails-when-attachments-arent-allowed-anymore/30429/1 "2015-06-24T22:20:49Z")

</div>

I’m not sure if this can be called a bug, but it is an unexpected behavior:

**Steps to reproduce:**

- Add a new file extension like `tif` to `authorized_extensions`
- Attach a file with that extension to a post
- Remove the file extension from `authorized_extensions`
- Rebake all posts using `rake posts:rebake`

**Expected behavior:**  
Rebaking of all posts should work, even though the previously attached file extension isn’t allowed anymore.

**Actual behavior:**  
Rebaking of posts fails for all posts that have attachments which aren’t allowed anymore. They are stuck in the sidekiq retry queue. The error message is:

```
Job exception: Wrapped ActiveRecord::RecordInvalid: Validation failed: Original filename Sorry, the file you are trying to upload is not authorized (authorized extensions: jpg, jpeg, png, gif).

```

**Additional information:**  
This error happens only with images. It doesn’t seem to happen with other file types.  
Lowering `max_image_size_kb` also results in errors:

```
Job exception: Wrapped ActiveRecord::RecordInvalid: Validation failed: Filesize Sorry, the image you are trying to upload is too big (maximum size is 3072KB), please resize it and try again.

```

---

_[View the full topic](https://meta.discourse.org/t/rebaking-posts-fails-when-attachments-arent-allowed-anymore/30429)._
