Possible onebox bug

(Lars) #1

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: e-Liquid Calculator :: DIY Custorrone ejuice (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: e-Liquid Calculator - 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…

(Sam Saffron) #2

Interesting edge case here with final destination @eviltrout

(Robin Ward) #4

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?

(Lars) #5

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…

(Jeff Atwood) #6

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

I pasted https://goo.gl/EwfRSe

I pasted https://goo.gl/1Hq0XP

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…

(Sam Saffron) #7

Sort of a rebake will still break stuff if intermediates die

(Eli the Bearded) #8

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

(Christoph) #9

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).

(Lars) #10

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