Disable short URL like in 3.1

Get help with installation and running phpBB 3.2.x here. Please do not post bug reports, feature requests, or extension related questions here.
User avatar
wolfbeast
Registered User
Posts: 69
Joined: Sat Aug 10, 2013 1:24 am

Disable short URL like in 3.1

Post by wolfbeast »

I recently migrated from 3.1 to 3.2 and something I rely on heavily changed:
Previously, when wrapping a URL in [ url ] tags it would retain the full displayed URL and make a link of it.
v3.2 however doesn't do this anymore and shortens the URL no matter if it's wrapped or not, removing this alternate behavior.

How do I get back to the 3.1 behavior? Is this considered a bug by the dev team? It is by me.
User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 51466
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Disable short URL like in 3.1

Post by stevemaury »

I'm not sure why it would be intended behavior. Report it in the Bug Tracker - http://tracker.phpbb.com/

You could use code tags, but the link would not be hot.
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
User avatar
wolfbeast
Registered User
Posts: 69
Joined: Sat Aug 10, 2013 1:24 am

Re: Disable short URL like in 3.1

Post by wolfbeast »

stevemaury wrote:
Sat Apr 27, 2019 6:23 pm
I'm not sure why it would be intended behavior.
There's no way to display the full URL of the link people are going to click on the way it is now.
It's fine to magically shorten if just placed in text, but if a poster explicitly indicates it's a URL then it shouldn't be shortened. This behavior has existed for a long time (since 3.0 at least) and I didn't expect it to be changed.
User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 51466
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Disable short URL like in 3.1

Post by stevemaury »

I am agreeing with you. Report it to the Bug Tracker.
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
User avatar
wolfbeast
Registered User
Posts: 69
Joined: Sat Aug 10, 2013 1:24 am

Re: Disable short URL like in 3.1

Post by wolfbeast »

I did and I got the door slammed in my face "This change was intentional", ticket closed, referring to a discussion that goes over my head about regexes.
https://tracker.phpbb.com/browse/PHPBB3-16033
Last edited by wolfbeast on Sat Apr 27, 2019 8:06 pm, edited 1 time in total.
User avatar
wolfbeast
Registered User
Posts: 69
Joined: Sat Aug 10, 2013 1:24 am

Re: Disable short URL like in 3.1

Post by wolfbeast »

So, I'm guess I need to get help from the community for hacking the files myself then.

Source:

Code: Select all

1. {somelongurl}
2. [url]{somelongurl}[/url]
3. [url={somelongurl}]{somelongurl}[/url]
4. [url={somelongurl}]sometext[/url]
Current behavior (IMHO wrong):
1. {some...url}
2. {some...url}
3. {some...url}
4. sometext

If anything, 3 is even worse -- it should never touch the text between url= tags, even if it's a url.

Desired result:
1. {some...url}
2. {somelongurl}
3. {somelongurl}
4. sometext
User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 51466
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Disable short URL like in 3.1

Post by stevemaury »

THIS:

Code: Select all

[url=phpbb.com/community/viewtopic.php?p=15242196#p15242196]phpbb.com/community/viewtopic.php?p=15242196#p15242196[/url]
PRODUCES THIS:

phpbb.com/community/viewtopic.php?p=15242196#p15242196
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
User avatar
wolfbeast
Registered User
Posts: 69
Joined: Sat Aug 10, 2013 1:24 am

Re: Disable short URL like in 3.1

Post by wolfbeast »

THIS:

Code: Select all

[url=http://xref.binaryoutcast.com/binoc-central/source/mozilla/application/palemoon/themes/windows/statusbar/overlay.css]http://xref.binaryoutcast.com/binoc-central/source/mozilla/application/palemoon/themes/windows/statusbar/overlay.css[/url]
PRODUCES THIS:

http://xref.binaryoutcast.com/binoc-cen ... verlay.css

Your URL is probably not shortened because it is a relative url to phpbb (is it even long enough?)
User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 51466
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Disable short URL like in 3.1

Post by stevemaury »

Leave off the http*:// and www. (if any)

Code: Select all

[url=microsoft.com/veryveryverylong_foldername/1234567890/veryveryverylong_filename.xxx]microsoft.com/veryveryverylong_foldername/1234567890/veryveryverylong_filename.xxx[/url]
microsoft.com/veryveryverylong_foldername/1234567890/veryveryverylong_filename.xxx
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
User avatar
wolfbeast
Registered User
Posts: 69
Joined: Sat Aug 10, 2013 1:24 am

Re: Disable short URL like in 3.1

Post by wolfbeast »

stevemaury wrote:
Sat Apr 27, 2019 8:52 pm
Leave off the http*:// and www. (if any)
You can't do that. If the protocol is different than what you're on it will fail. The URL will be wrong.
Board runs https and you want to post an http url? Can't do it. Want to post an ftp address? can't do that either...
It's clearly a bug that it shortens every fully-formatted URL it encounters.

Try linking to

Code: Select all

ftp://microsoft.com/veryveryverylong_foldername/1234567890/veryveryverylong_filename.xxx
without it shortening.

ftp://microsoft.com/veryveryverylong_fo ... lename.xxx

Also, for quite a few domains the root domain and www.domain.tld are NOT interchangeable. so using www is often needed. And that can't be done either.
www.microsoft.com/veryveryverylong_fold ... lename.xxx
User avatar
JoshyPHP
Code Contributor
Posts: 1138
Joined: Mon Jul 11, 2011 12:28 am

Re: Disable short URL like in 3.1

Post by JoshyPHP »

If you want to implement your own logic for shortening links, it's possible to do it via an extension. I haven't tried it but something like that should work:

Code: Select all

class listener implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
{
	public static function getSubscribedEvents()
	{
		return ['core.text_formatter_s9e_configure_after' => 'onConfigure'];
	}
	public function onConfigure($event)
	{
		$configurator->tags['LINK_TEXT']->filterChain->add(__CLASS__ . '::filterLinkText'))
			->resetParameters()
			->addParameterByName('tag')
			->addParameterByName('openTags');
	}
	public static function filterLinkText(s9e\TextFormatter\Parser\Tag $tag, array $openTags)
	{
		// Invalidate if the most recent open tag uses 5 chars, assumed to be "[url]"
		if (end($openTags)->getLen() === 5)
		{
			$tag->invalidate();
		}
	}
}
I wrote the thing that does BBCodes in 3.2+.
User avatar
kinerity
Community Team Member
Community Team Member
Posts: 2776
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Truscott
Contact:

Re: Disable short URL like in 3.1

Post by kinerity »

There's an extension that enables full links. Full Links extension
Kailey Truscott - Community Team
GitHub repositories (including un-released extensions)
User avatar
EA117
Registered User
Posts: 1765
Joined: Wed Aug 15, 2018 3:23 am
Contact:

Re: Disable short URL like in 3.1

Post by EA117 »

kinerity wrote:
Sat Apr 27, 2019 10:15 pm
There's an extension that enables full links. Full Links extension
Nice. Couldn't be an more elegant. Not withstanding that there is still "no control for when the URL should and should not be shortened" as with phpBB 3.1. i.e. Now "all URLs are non-shortened" with the extension, versus "all are shortened" in phpBB 3.2 without the extension. Still a really great solution.

I understand why removing the LINK_TEXT tag that was constructed prevents the shortened URL from being displayed. (For all cases; not just where [url] was used in any specific way.) But I'm curious whether you recall knowledge or investigation of the issue concluding anything about why the link shortening wasn't already "conditional" in phpBB 3.2.x, such that the extension was necessary.

The code to make shortening conditional on how [url] was used appears to be there in how the text-formatter and helpers were implemented in 3.2.x. And the Area51 discussion thread cited seems to conclude that they believe currently the [url=longurl]longurl[/url] usage actually was not affected, and was not shortening the displayed URL; and only the "other cases" would intentionally shorten the URL, and this was agreed to be satisfactory. But that's not the ultimate behavior in 3.2.x, and the URL is "always" shortened.

I had a couple of theories, but nothing I've have time to prove under debugging yet:

One is that the code actually does leave the link non-shortened with the the [url=longurl]longurl[/url] usage, as seemingly the code intends. But then some unintentional double- or re-parse treats that "non-shortened" URL text created by the BBCode parsing as though that text needs AutoLink processing applied to it, and that's when the URL in the "for display only" text becomes intentionally shortened anyway.

The other is wanting to test whether the link_helper::should_shorten() string match for "[url]" is actually working, versus whether there is already something different like "[url:uid]" or similar in the string being tested at that point.
User avatar
JoshyPHP
Code Contributor
Posts: 1138
Joined: Mon Jul 11, 2011 12:28 am

Re: Disable short URL like in 3.1

Post by JoshyPHP »

I haven't really read this last post but it will probably get fixed by this: https://tracker.phpbb.com/browse/PHPBB3-16034
I wrote the thing that does BBCodes in 3.2+.
User avatar
EA117
Registered User
Posts: 1765
Joined: Wed Aug 15, 2018 3:23 am
Contact:

Re: Disable short URL like in 3.1

Post by EA117 »

JoshyPHP wrote:
Sun Apr 28, 2019 12:47 am
I haven't really read this last post but it will probably get fixed by this: https://tracker.phpbb.com/browse/PHPBB3-16034
The #5577 commit changes are far enough above my pay grade to keep me from understanding what condition they're resolving, but I'm happy not to poke it with a stick. 😃

What I can confirm is that those commit changes address the issue in my usage here, too. Meaning the behavior now matches what seemed to be concluded in the the Area51 thread; which was that [url=...]...[/url] usage should not be shortened, but [url]...[/url] and raw ... usage (without any BBCode) were appropriate for the URL to be shortened.

Older existing messages were also fixed, once a manual reparse was performed after implementing the #5577 commit changes in /phpbb/textformatter/s9e/link_helper.php.

Thanks for giving some attention to this, and making the actual controllable behavior available.
Post Reply

Return to “[3.2.x] Support Forum”