# Missing images in discourse website. while they exist in upload folder

**URL:** https://meta.discourse.org/t/missing-images-in-discourse-website-while-they-exist-in-upload-folder/187489
**Category:** Support
**Created:** [April 20, 2021, 2:42pm UTC](https://meta.discourse.org/t/missing-images-in-discourse-website-while-they-exist-in-upload-folder/187489 "2021-04-20T14:42:47Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [April 20, 2021, 2:42pm UTC](https://meta.discourse.org/t/missing-images-in-discourse-website-while-they-exist-in-upload-folder/187489/1 "2021-04-20T14:42:48Z")

</div>

I just tried to change the title of an old topic. Then I realized that all images in the topic are now transparent.png and not showing properly.

 ![Screenshot from 2021-04-20 19-11-07](https://global.discourse-cdn.com/meta/original/3X/0/4/04644548f9d15be0a988141c1c73167eea432b6a.png)

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [April 20, 2021, 4:36pm UTC](https://meta.discourse.org/t/missing-images-in-discourse-website-while-they-exist-in-upload-folder/187489/2 "2021-04-20T16:36:07Z")

</div>

`rake uploads:recover` followed by `rake posts:rebake` didn’t fix the problem.

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [April 20, 2021, 8:38pm UTC](https://meta.discourse.org/t/missing-images-in-discourse-website-while-they-exist-in-upload-folder/187489/3 "2021-04-20T20:38:25Z")

</div>

I can access the image by `https://talk.zabanshenas.com/uploads/default/original/3X/8/7/8726fbef7b69ac8226d28568b46f3e06afe2fb4f.jpeg`

the upload itself is : `![164389418-how-i-met-your-mother-wallpapers|666x500](upload://jhBYRiSdEO0a8JYypd6XapJbpaD.jpeg) `

However when I do :

` Upload.where( "url LIKE '%8726fbef7b69ac8226d28568b46f3e06afe2fb4f%'" )`  
I get  
`=> []`

any idea?

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [April 21, 2021, 5:04am UTC](https://meta.discourse.org/t/missing-images-in-discourse-website-while-they-exist-in-upload-folder/187489/4 "2021-04-21T05:04:45Z")

</div>

if I upload the exact same image again somewhere else, the old post would also show the image after rebake. so I think its something with indexing some of old uploaded files. How can I **re index** all uploaded files again? Or even better, indexing missing ones.

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [April 21, 2021, 12:19pm UTC](https://meta.discourse.org/t/missing-images-in-discourse-website-while-they-exist-in-upload-folder/187489/5 "2021-04-21T12:19:08Z")

</div>

Update:

I read some rake tasks and saw `rake posts:recover_uploads_from_index` which seems to fix my issue. However I’m getting the following error:

```plaintext
undefined method `split' for nil:NilClass
from /var/www/discourse/app/models/site_setting.rb:151:in `s3_base_url'

```

I dont have s3 uploads enabled for my website 🧐 🧐

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [April 21, 2021, 2:31pm UTC](https://meta.discourse.org/t/missing-images-in-discourse-website-while-they-exist-in-upload-folder/187489/6 "2021-04-21T14:31:27Z")

</div>

Update:

I made a temporary ugly fix for above error ([commenting this line](https://github.com/discourse/discourse/blob/master/lib/tasks/posts.rake#L534)) and run the rake task. but it wasn’t what i was thinking:

```plaintext
Searching for upload://dC9HyffX3S1XbwwdUOsHe5aMyJX.jpeg (dC9HyffX3S1XbwwdUOsHe5aMyJX) in index                                                                                                             
Skipping upload://dC9HyffX3S1XbwwdUOsHe5aMyJX.jpeg in https://talk.zabanshenas.com/t/topic/4430/1 cause it appears to have a short file name                                                               
Searching for upload://kWx14u8XkQ8qd6NvOoDLN6usTl8.jpeg (kWx14u8XkQ8qd6NvOoDLN6usTl8) in index                                                                                                             
Skipping upload://kWx14u8XkQ8qd6NvOoDLN6usTl8.jpeg in https://talk.zabanshenas.com/t/topic/4430/1 cause it appears to have a short file name  

```

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [April 23, 2021, 5:39pm UTC](https://meta.discourse.org/t/missing-images-in-discourse-website-while-they-exist-in-upload-folder/187489/7 "2021-04-23T17:39:56Z")

</div>

I went further into the rake task `rake uploads:recover`. I think there is something wrong in the following line:

> <https://github.com/discourse/discourse/blob/e3b1d1a7183c2f68c4e9acdd2faac453d9430e1f/lib/upload_recovery.rb#L105>

as far as i understand here all files in `uploads/default/original` should be added to `@paths`. However I tried to print `@paths` into a file and I only see tombstone files is listed.

Am I missing something here? 🤔 @cvx

I think it should be like

```plaintext
concat(Dir.glob(File.join(
      Rails.root, "public", Discourse.store.upload_path,
      'original',
      '**',
      '*.*'
    )))

```
