Onebox not embedding locally uploaded media files

AI-generated summary

User optimus reported a bug where locally uploaded FLV video files on their Discourse instance failed to embed as oneboxes, appearing only as download links instead. While they successfully enabled the relevant admin setting for Flash embedding, external FLV links oneboxed correctly, but local paths (e.g., /uploads/...) did not. optimus noted that even whitelisting their own domain did not resolve the issue. codinghorror initially suggested it might be a bug, pointing to the separate onebox codebase. riking confirmed the behavior was a bug, explaining that local links were treated differently than external ones. riking subsequently fixed the issue via a pull request. optimus asked if manual patching was required, but riking clarified the fix was merged and would be included in the next update. optimus confirmed the fix worked after updating to version 1.3.0.beta6. Later, techAPJ revisited the issue to ensure it was properly resolved in a subsequent commit.

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…

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) :frowning:. See below…

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

4 „Gefällt mir“

Anyone have any advice on this?

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

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

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

https://github.com/discourse/onebox

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

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 :frowning:. Any more help on this? Pretty please.

TIA,
Chris

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
1 „Gefällt mir“

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

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

I just fixed this!

https://github.com/discourse/discourse/pull/3387

4 „Gefällt mir“

Great news, this is so so awesome @riking :smiley:!!! 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

Thanks again!
-Chris

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

2 „Gefällt mir“

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

1 „Gefällt mir“

Revisited this issue again via:

https://github.com/discourse/discourse/commit/3a28bafc0f233710cff868319eb7f70672f53bad

Should be properly fixed now.

2 „Gefällt mir“