# Onebox shown as iframe raw html

**URL:** https://meta.discourse.org/t/onebox-shown-as-iframe-raw-html/65935
**Category:** Bug
**Created:** [10 يوليو 2017، 12:31م UTC](https://meta.discourse.org/t/onebox-shown-as-iframe-raw-html/65935 "2017-07-10T12:31:21Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [10 يوليو 2017، 12:31م UTC](https://meta.discourse.org/t/onebox-shown-as-iframe-raw-html/65935/1 "2017-07-10T12:31:21Z")

</div>

I’m having trouble with the oneboxing of this url:

> **[After Mr. Sam](https://www.nfb.ca/film/after_mr_sam/)**
>
> This full-length documentary is the 7th and final part of Corporation, a film series about the inner workings of the Steinberg supermarket chain. This installment documents a 3-day …

It is rendered correctly in the preview but once the post is saved, the raw html of the iframe is shown instead of the onebox.

In case it matters: I am editing another users post who has posted the url as an ordinary link.

Update: it obviously didn’t matter, since the same is happening in this post.

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [10 يوليو 2017، 4:08م UTC](https://meta.discourse.org/t/onebox-shown-as-iframe-raw-html/65935/2 "2017-07-10T16:08:53Z")

</div>

That is super strange. I will look into it.

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [10 يوليو 2017، 6:26م UTC](https://meta.discourse.org/t/onebox-shown-as-iframe-raw-html/65935/4 "2017-07-10T18:26:21Z")

</div>

It looks like the standard way of oneboxing a movie is now with a type of `video.movie` and we didn’t support a period in that field. I’ve fixed it in this commit:

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

Unfortunately after applying the fix, while the iframe is not raw HTML it still does not display. It looks like the video URL is not one that can be shown in a `video` tag. It seems to be a HTML URL for showing a video using Javascript and not an actual video.

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [10 يوليو 2017، 6:50م UTC](https://meta.discourse.org/t/onebox-shown-as-iframe-raw-html/65935/5 "2017-07-10T18:50:51Z")

</div>

I have not tried the fix yet because it hasn’t passed all tests yet, but I understand that the onebox will now render like it previously did in the preview, i.e. like a non-video onebox?

What I don’t understand is why it rendered fine in the preview but not the final result.

With the number of onbox issues reported over the past weeks, my impression is that oneboxing is a rather fragile feature in discourse and although I’m not sure if anything can be done about this, it would be nice if this kind of raw html result could somehow be made impossible, i.e. to have some double checking going on that would notice if that happens and revert back to secure grounds.

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [10 يوليو 2017، 6:54م UTC](https://meta.discourse.org/t/onebox-shown-as-iframe-raw-html/65935/6 "2017-07-10T18:54:50Z")

</div>

The preview cannot play a video, so it makes up HTML based on the image and text provided.

The actual content uses the video tag and the URL they provide, which is broken in this case.

Oneboxing is indeed fragile because it depends on content on other people’s sites that is free to change at any time.

> **[Garbage in, garbage out](https://en.wikipedia.org/wiki/Garbage_in,_garbage_out)**
>
> In computer science, garbage in, garbage out (GIGO) is the concept that flawed, biased or poor quality (garbage) information or input produces a result or output of similar ("garbage") quality. The saying points to the need to improve data quality in, for example, programming. Rubbish in, rubbish out (RIRO) is an alternate wording.
> The principle applies to all logical argumentation: soundness implies validity, but validity does not imply soundness. In other words, assumptions matter: even if som...

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [10 يوليو 2017، 6:59م UTC](https://meta.discourse.org/t/onebox-shown-as-iframe-raw-html/65935/7 "2017-07-10T18:59:30Z")

</div>

> [@eviltrout](#):
>
> Oneboxing is indeed fragile because it depends on content on other people’s sites that is free to change at any time.

I understand that, but I was wondering if it could be made more rigid by detecting when “garbage out” is about to occur and instead of actually rendering the garbage revert back to, say, a plain hyperlink.

BTW: the commit seems to have failed the tests…

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [10 يوليو 2017، 7:03م UTC](https://meta.discourse.org/t/onebox-shown-as-iframe-raw-html/65935/8 "2017-07-10T19:03:46Z")

</div>

> [@tophee](#):
>
> I was wondering if it could be made more rigid by detecting when “garbage out” is about to occur

We can’t possibly account for all the different ways people can mess up their sites. For this, we’d have to crawl the embedded URL and make sure it’s a playable movie URL. That’s a lot of work to handle a site that is broken!

> [@tophee](#):
>
> BTW: the commit seems to have failed the tests…

That’s just Travis being temperamental, it was built fine.

---

<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: [10 يوليو 2017، 7:09م UTC](https://meta.discourse.org/t/onebox-shown-as-iframe-raw-html/65935/9 "2017-07-10T19:09:31Z")

</div>


