Double link urls when pasting over bbcode `[url` tags

Continuing the discussion from Please don't double link urls if one pastes over a URL in markdown:

Yesterday, this was fixed on my site, but this morning it’s right back to making a double URL when I want to past over an existing one.

Can you reproduce this on meta? I wonder if you found a new edge case?

1 Like

I had a link that started out with “## [url= <link> [/url]”

[## url=

Then when I tried to copy/paste over the link, I get the above result. Puts it completely outside of the [url= [/url] coding.

And, yes, I just did that here on Meta

1 Like

Oh that is BBCODE links, we do not use them that commonly hence we did not build a heuristic for it.

We will get this sorted, maybe @gwwar can send through a PR?

Any reason you are leaning on BBCODE links vs Markdown ones? Mostly up to habit?

Yes, over 10 years worth of habit. I’ve tried to change, but my fingers will not listen.

1 Like

Sure, I can see if there’s a decent fix for this.

1 Like

Let’s see, so for my own reference, url and email bb tags work like the following. They may also support magic links, where the URI protocol doesn’t need to be specified.

[url=][/url]
[url=https://www.phpbb.com/]Visit phpBB![/url]
[url]https://www.phpbb.com/[/url]
[email]example@example[/email]

https://www.phpbb.com/community/help/bbcode

Behavior-wise, I think it’d be reasonable to test if a text-selection contains a bbcode email or url tag. Depending on what folks run into, we could also widen the test to default to default paste behavior if we detect any bbcode tags.

3 Likes

I added a PR here. Let me know if this isn’t the use case folks were thinking of.

4 Likes

Sorry to bring this up again, but is there some timeline for when this will be fixed? I know sometimes it takes a few days, but this is still happening as of this morning.

The PR was approved, but needs a Discourse Team member to merge. @eviltrout were we waiting on any other feedback?

@Slowhand can I just double check, how much of the [url tag are you highlighting before pasting? If I’m understanding it correctly, I think think @gwwar’s PR only covers option 1 below. Will that fix the issue for you?


Option 1:

This is a sentence with [url=discourse.org]A link[/url]

Option 2:

This is a sentence with [url=discourse.org]A link[/url]

Option 3:

This is a sentence with [url=discourse.org]A link[/url]

Option 2 is the one I’m having trouble with.

Can you post an example starting point? With Option 2 exactly as I posted above, it seems to be working fine for me already, even without the new PR.

discourse.org is detected as an existing URL, and so the fancy pasting behaviour is bypassed :thinking:

For Option 2, we have links to Daily specials from an anime site, so I usually just copy/paste the previous days’ links to a new post and then change them, saving me typing all that coding.

Example: this morning I copied yesterday’s deals

and pasted the links with today’s deals

causing this to happen:
image

If I select this

[url=https://www.rightstufanime.com/Some-Link]Text[/url]

And then paste

https://www.rightstufanime.com/Deca-Dence-Blu-ray
I end up with:
[url=https://www.rightstufanime.com/Deca-Dence-Blu-ray]Text[/url]

Could you see whether you can reproduce the issue you’re seeing here on Meta? (note that [url tags don’t actually render here, but you should still be able to try out the composer behavior)

Based on your last screenshot, I think you might be selecting the whole line, including the bullet point and the [url=blah]test[/url] wrapper? (i.e. almost the same as “Option 1” above)?

I can not reproduce the behavior here on Meta.

I don’t believe I’m selecting the whole line because I don’t want to have to retype all the coding. I would suppose that occasionally I might accidentally click the whole thing, but I’ve been very careful lately because of this problem.

But, let me ask you this, if I AM selecting the whole thing, is that the proper behavior? Instead of just putting in what I’m pasting, it adds it at the end and leaves what I originally highlighted?

Let me apologize again for not being very tech savvy, this is a little over my head.
If I just really need to alter how I’m doing this, I will.

1 Like

Ok that’s super interesting! Just to confirm, would you mind repro-ing one more time on your own forum? If there’s a difference, please do let us know so we can get to the bottom of it.

I’d say ‘no’, it’s not the proper behaviour. We should absolutely fix it, and @gwwar’s PR does that. I just wanted to figure out exactly what the use-case was here to make sure we have all angles covered.

I’ll get that PR merged now, so it should be deployed to your site in the next few days @Slowhand

Thanks for bearing with me on all the questions! :sweat_smile:

Nope, same thing.

Thanks so much for all your help!

1 Like

Note that option 2 should in theory be handled by

If folks still run into trouble with additional corner cases, it may make sense to add in a site or user setting to toggle the behavior.

3 Likes

This topic was automatically closed after 10 days. New replies are no longer allowed.