# Onebox not embedding locally uploaded media files

**URL:** https://meta.discourse.org/t/onebox-not-embedding-locally-uploaded-media-files/26238
**Category:** Bug
**Created:** [3월 11, 2015, 9:34오후 UTC](https://meta.discourse.org/t/onebox-not-embedding-locally-uploaded-media-files/26238 "2015-03-11T21:34:49Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![optimus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/optimus/32/39715_2.png) [@optimus](https://meta.discourse.org/u/optimus)
#### Post date: [3월 11, 2015, 9:34오후 UTC](https://meta.discourse.org/t/onebox-not-embedding-locally-uploaded-media-files/26238/1 "2015-03-11T21:34:49Z")

</div>

Hi all,

One of the uses of my Discourse will be a video “library” where I want to allow moderators to post video tutorials to help users. I enabled the “Enable embedding of swf and flv (Adobe Flash) links in oneboxes…” option under /admin/site\_settings/category/onebox, and then added a new topic and uploaded a flv file.

Below is what it looks like…

 ![](https://global.discourse-cdn.com/meta/original/3X/7/1/712a7933ecc5ad0e3c7120cbb5e83a68ce988352.jpg)

What I want is for the flv file to onebox or embed in the topic, not a link to download. So then I tried changing the link using the Editor and used the “Insert Hyperlink” button in the editor to change it from…

```
<a class="attachment" href="/uploads/default/32/ec65cca47b7bff0d.flv">How to open a service request.flv</a>

```

to…

```
[how to create a service request][1]

  [1]: http://discourse.mydomain.org/uploads/default/32/ec65cca47b7bff0d.flv

```

And it is just a link (no onebox) ☹. See below…

 ![](https://global.discourse-cdn.com/meta/original/3X/8/9/89c2f8ac4dc58e12934256e66825d7681932f3e7.jpg) 

Is there something else I need to do to have the flv files get onebox’d? Basically I want the flv files to just show embeded in the topic so the user does not have to download the flv file first - I’d like them to be able to just watch straight on the topic.

Thanks for any help or tips! If I am not understanding how this should work, please let me know what I am doing wrong, just started using Discourse recently.

PS - I have to put out there that the Discourse community has made me welcome and everyone has been super helpful to me. I am loving Discourse and I really think it’s going to benefit my organization.

Best,  
Chris

---

<div class="post-metadata">

### Author: ![optimus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/optimus/32/39715_2.png) [@optimus](https://meta.discourse.org/u/optimus)
#### Post date: [3월 17, 2015, 10:47오후 UTC](https://meta.discourse.org/t/onebox-not-embedding-locally-uploaded-media-files/26238/2 "2015-03-17T22:47:33Z")

</div>

Anyone have any advice on this?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [3월 19, 2015, 11:15오후 UTC](https://meta.discourse.org/t/onebox-not-embedding-locally-uploaded-media-files/26238/3 "2015-03-19T23:15:27Z")

</div>

> [@optimus](#):
>
> I enabled the “Enable embedding of swf and flv (Adobe Flash) links in oneboxes…” option under /admin/site\_settings/category/onebox

That should be all that is necessary, perhaps there is a bug.

---

<div class="post-metadata">

### Author: ![optimus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/optimus/32/39715_2.png) [@optimus](https://meta.discourse.org/u/optimus)
#### Post date: [3월 20, 2015, 5:57오후 UTC](https://meta.discourse.org/t/onebox-not-embedding-locally-uploaded-media-files/26238/4 "2015-03-20T17:57:08Z")

</div>

Yes, I think it might be a bug. Anything I can do to help get this fixed, or any workarounds (modify code) 😄?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [3월 20, 2015, 7:56오후 UTC](https://meta.discourse.org/t/onebox-not-embedding-locally-uploaded-media-files/26238/5 "2015-03-20T19:56:34Z")

</div>

The oneboxer was pulled out into its own code, so perhaps there?

[https://github.com/discourse/onebox](https://github.com/discourse/onebox)

---

<div class="post-metadata">

### Author: ![optimus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/optimus/32/39715_2.png) [@optimus](https://meta.discourse.org/u/optimus)
#### Post date: [3월 25, 2015, 5:00오후 UTC](https://meta.discourse.org/t/onebox-not-embedding-locally-uploaded-media-files/26238/6 "2015-03-25T17:00:25Z")

</div>

As I test, I added a link to an flv file on an outside site ([http://www.mediacollege.com/video-gallery/testclips/barsandtone.flv](http://www.mediacollege.com/video-gallery/testclips/barsandtone.flv)) and it gets Onebox’d fine.

 ![](https://global.discourse-cdn.com/meta/original/3X/6/4/6484acdcdea9772982bd2afbe84aed8d7699bfeb.jpg) 

It seems like only flv files uploaded **on the localhost** (server hosting Discourse) don’t get Onebox.

I did whitelist own domain in Discourse from /admin/site\_settings/category/onebox and also selected the " Enable embedding of swf and flv (Adobe Flash) links in oneboxes…" option, but still does not work. Does this give any clue to a dev out there? I wish I knew where to start to get this fixed. I am willing to manually fix this but just don’t know where to start ☹. Any more help on this? Pretty please.

TIA,  
Chris

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [3월 26, 2015, 6:00오전 UTC](https://meta.discourse.org/t/onebox-not-embedding-locally-uploaded-media-files/26238/7 "2015-03-26T06:00:22Z")

</div>

I think this is a bug behavior, so I re-titled it as such. The local links shouldn’t really be treated differently here.

* * *

The bug is that this will onebox:

```
http://joes-redirector.com/redirect?url=discourse.example.com/uploads/default/40190/4e05693704bf6ba6.mp3

```

And this won’t:

```
/uploads/default/40190/4e05693704bf6ba6.mp3

```

---

<div class="post-metadata">

### Author: ![optimus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/optimus/32/39715_2.png) [@optimus](https://meta.discourse.org/u/optimus)
#### Post date: [3월 26, 2015, 2:11오후 UTC](https://meta.discourse.org/t/onebox-not-embedding-locally-uploaded-media-files/26238/8 "2015-03-26T14:11:05Z")

</div>

Thanks for re-categorizing this as a bug, @riking!

---

<div class="post-metadata">

### Author: ![optimus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/optimus/32/39715_2.png) [@optimus](https://meta.discourse.org/u/optimus)
#### Post date: [4월 8, 2015, 4:49오후 UTC](https://meta.discourse.org/t/onebox-not-embedding-locally-uploaded-media-files/26238/9 "2015-04-08T16:49:54Z")

</div>

HI there, has there been any update on getting this fixed 😄?

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [4월 22, 2015, 6:07오전 UTC](https://meta.discourse.org/t/onebox-not-embedding-locally-uploaded-media-files/26238/10 "2015-04-22T06:07:42Z")

</div>

I just fixed this!

[https://github.com/discourse/discourse/pull/3387](https://github.com/discourse/discourse/pull/3387)

---

<div class="post-metadata">

### Author: ![optimus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/optimus/32/39715_2.png) [@optimus](https://meta.discourse.org/u/optimus)
#### Post date: [4월 22, 2015, 2:27오후 UTC](https://meta.discourse.org/t/onebox-not-embedding-locally-uploaded-media-files/26238/11 "2015-04-22T14:27:23Z")

</div>

Great news, this is so so awesome @riking 😃!!! I am really eager to try out the fix this in my Discourse installation now. I took a look at fix on Github. Can you confirm if I just need to make those changes to the 2 files and I will be good to go?  
-remove one line and add 2 lines to app/assets/javascripts/discourse/lib/onebox.js  
and  
-add 19 lines to lib/onebox/engine/discourse\_local\_onebox.rb

 ![](https://global.discourse-cdn.com/meta/original/3X/2/7/278a952de951ca6394ea602a1cd848dfd0bdf7ef.jpg) 

Thanks again!  
-Chris

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [4월 22, 2015, 4:18오후 UTC](https://meta.discourse.org/t/onebox-not-embedding-locally-uploaded-media-files/26238/12 "2015-04-22T16:18:29Z")

</div>

The fix is merged, no need to monkeypatch it in. You’ll get it in the next update.

---

<div class="post-metadata">

### Author: ![optimus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/optimus/32/39715_2.png) [@optimus](https://meta.discourse.org/u/optimus)
#### Post date: [4월 22, 2015, 6:20오후 UTC](https://meta.discourse.org/t/onebox-not-embedding-locally-uploaded-media-files/26238/13 "2015-04-22T18:20:35Z")

</div>

I got the notification about 1.3.0.beta6 and I already updated my Discourse - it’s working :)!!! Thanks again @riking. You rock.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [1월 1, 2016, 3:31오후 UTC](https://meta.discourse.org/t/onebox-not-embedding-locally-uploaded-media-files/26238/14 "2016-01-01T15:31:32Z")

</div>

Revisited this issue again via:

[https://github.com/discourse/discourse/commit/3a28bafc0f233710cff868319eb7f70672f53bad](https://github.com/discourse/discourse/commit/3a28bafc0f233710cff868319eb7f70672f53bad)

Should be properly fixed now.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [1월 1, 2016, 3:31오후 UTC](https://meta.discourse.org/t/onebox-not-embedding-locally-uploaded-media-files/26238/15 "2016-01-01T15:31:35Z")

</div>


