Pass unresolved onebox links to onebox

I’m not sure it’s a bug - To me it seems like it is.

Let me explain quickly. On my site people can create private recipes. They can then create a special URL to share this private recipe with people. A “token” is added to the query string: (this is a shortened URL) - The onebox’er correctly parses the data and shows a onebox. However, the onebox now links directly to the content: - which won’t work for people beacuse of the missing “token” that was in the original URL (the original sets a session variable and redirects).

My question is this: Shouldn’t the onebox use the original URL that you wanted to share?

I’ve worked around it by adding the token to the redirect and added code to support this in the app…


Interesting edge case here with final destination @eviltrout


This one is tricky due to the way the app calculates the final destination for a URL for security reasons. If a URL has several redirects we resolve the final URL and then pass that to onebox for rendering.

I suppose we could pass the original URL through and have the onebox render that if present, but I suspect in most cases you’d prefer to have it link to the redirected content, not the initial content?


The latter seems better to me, but do you guys have a policy about shortlinks in general? Do you expand them for the benefit of the users? I know that the shortlink-services offer statistics, but they wouldn’t work on Discourse… Other than that, the only edge case I can think of is sort of like mine, where the shortlink holds a key to accessing the final URL…

Oh wow cool so a shortened URL will be resolved for onebox? Let’s see

I pasted

I pasted

Very cool @eviltrout – long term this is way more healthy since the final link will be stored in the post, not (x) intermediary dumb redirect service URLs, that might disappear or go out of business…


Sort of a rebake will still break stuff if intermediates die


That’s always true of URL shorteners, though, isn’t it?


Well, it would be conceivable that discourse disposes of the short url and declares independency from the short code provider (who will not be amused).

For obvious reasons, I’d prefer the initial URL to be passed to the onebox… :slight_smile: