Oneboxing not working when starting a topic with pre-filled information

AI-generated summary

Users are discussing an issue with oneboxing not working when starting a new topic using pre-filled information via URL. ethang reports that the example from the documentation—https://meta.discourse.org/new-topic?title=https://www.xkcd.com/556—fails because the URL gets malformed (one slash is stripped), preventing oneboxing. Falco clarifies that query parameters must be URL-encoded, suggesting the correct format: https://meta.discourse.org/new-topic?title=https%3A%2F%2Fwww.xkcd.com%2F556, which works as intended. ethang acknowledges the fix and suggests improving the documentation example. Canapin confirms the guide has been updated to include this clarification. The issue stems from URL encoding requirements, not a bug in Discourse.

The documentation on Create a link to start a new topic with pre-filled information says:

However, even when directly copy-pasting the listed example, a redirect appears to strip one of the slashes from the URL specified after title= , resulting in the browser instead navigating to https://meta.discourse.org/new-topic?title=https:/www.xkcd.com/556 which opens a composer window for a new topic with the pre-filled title https:/www.xkcd.com/556. The behavior and oneboxing described in Start a topic by pasting a link (like Reddit) then obviously doesn’t occur, unless you manually add another / back in to the title URL.

I first saw this behavior trying things out on my hosted Discourse and figured I might have something mis-configured, but then seems like a bug since it also happens with the provided example?

IMO you are expected to encode any query unsafe query params,

so

https://meta.discourse.org/new-topic?title=https://www.xkcd.com/556

becomes

https://meta.discourse.org/new-topic?title=https%3A%2F%2Fwww.xkcd.com%2F556

that works like Discourse Meta (open in a new tab)

ah! thank you, I would suggest the example be clarified but can proceed from here. Much appreciated!

I’ve added this info on the guide, thanks! :handshake: