• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.1 Conversations titled "..." or similar throw up 403 Forbiddens, can I alter my rule somehow?

lasertits

Active member
#1
Hello,

Wasn't sure where to post this, but I ran into this issue this morning, an individual sent me a conversation but he titled it "...." - XF parsed this into the following URL:

site.com/conversations/.3237/

Now, because of a rule I have that denies access to any .files, when I try to read this conversation I get hit with a 403 forbidden.
# Deny all attempts to access any dotfile (.htaccess, .htpasswd, .directory, etc)
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
I don't really want to remove that rule just for the sake of the possibility that others will title their conversations, or threads, or anything with just "..." or similar, as if they do they'll be hit with 403 Forbiddens as well.

Is there an edit I can do to the rule to fix this so it plays nicely with XF? Perhaps my best bet is to just limit it to the root DIR and ignore sub directories, perhaps it'll ignore the conversation URL's...

I'm a noob with rules such as this, so any insight would be appreciated, thanks!
 

Jake Bunce

XenForo moderator
Staff member
#2
I assume it works without the dot?

site.com/conversations/3237/

I think XF should remove the dot automatically if the URL title is empty. I suggest moving this to bugs.

Here is a quick file edit to implement this:

library/XenForo/Link.php

Add the red code:

Code:
	public static function buildIntegerAndTitleUrlComponent($integer, $title = '', $romanize = false)
	{
		if ($title && self::getTitleForUrl($title, $romanize) && XenForo_Application::get('options')->includeTitleInUrls)
		{
			# /item-title.id/ (where delimiter is '.')
			return urlencode(self::getTitleForUrl($title, $romanize)) . XenForo_Application::URL_ID_DELIMITER . intval($integer);
		}
		else
		{
			return intval($integer);
		}
	}