# Onebox relative icon URL bug

**URL:** https://meta.discourse.org/t/onebox-relative-icon-url-bug/88196
**Category:** Bug
**Created:** [May 23, 2018, 3:13am UTC](https://meta.discourse.org/t/onebox-relative-icon-url-bug/88196 "2018-05-23T03:13:24Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![dfabulich](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dfabulich/32/108716_2.png) [@dfabulich](https://meta.discourse.org/u/dfabulich)
#### Post date: [May 23, 2018, 3:13am UTC](https://meta.discourse.org/t/onebox-relative-icon-url-bug/88196/1 "2018-05-23T03:13:24Z")

</div>

> **[Grand Academy for Future Villains](https://www.choiceofgames.com/grand-academy-for-villains/)**
>
> Taking over the world? Welcome to the world's finest preparatory school for villains, where unimaginable evil begins with a world-class education!

This onebox has a white space in the upper left corner on Chrome, or, on Firefox, it shows a broken image icon.

The document contains a `<link>` tag like this:

```
<link href="icon.jpg?hash=daf03254ad467bb13b79bb3b5a637832" rel="icon">

```

That should resolve to [https://www.choiceofgames.com/grand-academy-for-villains/icon.jpg?hash=daf03254ad467bb13b79bb3b5a637832](https://www.choiceofgames.com/grand-academy-for-villains/icon.jpg?hash=daf03254ad467bb13b79bb3b5a637832) (which exists) but Discourse is incorrectly attempting to use [https://www.choiceofgames.com/icon.jpg?hash=daf03254ad467bb13b79bb3b5a637832](https://www.choiceofgames.com/icon.jpg?hash=daf03254ad467bb13b79bb3b5a637832) which doesn’t exist and gets a 404 error.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [May 23, 2018, 3:16am UTC](https://meta.discourse.org/t/onebox-relative-icon-url-bug/88196/2 "2018-05-23T03:16:42Z")

</div>

@techAPJ can you sort this out? perhaps if there is no domain just add the originating domain in the onebox lib?

---

<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: [May 23, 2018, 12:49pm UTC](https://meta.discourse.org/t/onebox-relative-icon-url-bug/88196/4 "2018-05-23T12:49:52Z")

</div>

> [@sam](#):
>
> perhaps if there is no domain just add the originating domain in the onebox lib

We already do that. The issue here was that the link was page relative url (`icon.jpg`) vs root relative url (`/icon.jpg`). We were not distinguishing between these two types. Now fixed via:

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

Thanks for bringing this in our notice @dfabulich. 👍

* * *

> **[Grand Academy for Future Villains](https://www.choiceofgames.com/grand-academy-for-villains/?1)**
>
> Taking over the world? Welcome to the world's finest preparatory school for villains, where unimaginable evil begins with a world-class education!

---

<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: [May 24, 2018, 1:00am UTC](https://meta.discourse.org/t/onebox-relative-icon-url-bug/88196/5 "2018-05-24T01:00:24Z")

</div>


