Question Background Path in Cached CSS is Absolute

Status
Not open for further replies.

semprot

Customer
I notice that when i activate "Store CSS as files", all background image path is converted from relative such as
Code:
/styles/default/something.png
into absolute URL such as
Code:
http://example.com/styles/default/something.png

In my opinion that should not be done, and path should be still relative.
The domain should not be inserted to the path.

Thank you.
 
Because of the fact that the CSS files are loaded from a sub-folder, it is not really feasible to use relative paths.

Do you have a particular reason why you feel this way?
 
Because of the fact that the CSS files are loaded from a sub-folder, it is not really feasible to use relative paths.

Do you have a particular reason why you feel this way?
I think the CSS cache is always located under
Code:
/data/dbtechOptimise/cssCache/<TIMESTAMP>/

So using relative path such as this will not be a problem
Code:
../../../../styles/default/something.png

Unless you / the user modifies the location of cached CSS.

In my situation :
My forum can be accessed by the IP, and the domain name.
The cached CSS seems to cache first request that hit the caching process (whether it's the IP / the domain name).
And that caused a problem so i have to disable the store CSS as files. :(
 
Can you please elaborate why this causes a problem? What problem does it cause?

If your site can be accessed by either, then surely it doesn't matter if the images are requested via the IP or the domain?

I'd love to hear more information about this :)
 
Can you please elaborate why this causes a problem? What problem does it cause?

If your site can be accessed by either, then surely it doesn't matter if the images are requested via the IP or the domain?

I'd love to hear more information about this :)
In my situation, a user access by IP because he can't access by domain name, because the domain name is censored by the ISP.
Few users can access by domain (if they use proxy / tor / vpn) :)
 
I see, thank you for the explanation.

I'll do some research and see if relative paths are viable :)
 
I see, thank you for the explanation.

I'll do some research and see if relative paths are viable :)
Thank you very much.
Or if at this moment you can tell me what file & which line that i should edit to make it happens, that will be great for me :)
 
/library/DBTech/Optimise/XenForo/CssOutput.php:69 is where the conversion to full URL happens.
 
/library/DBTech/Optimise/XenForo/CssOutput.php:69 is where the conversion to full URL happens.
Awesome, i made this edit, and it works :)

PHP:
//return "url('" . XenForo_Link::convertUriToAbsoluteUri($match[1], true, $requestPaths) . "')";
if (strpos($match[1], 'http://') === 0 || strpos($match[1], 'https://') === 0 || strpos($match[1], '//') === 0) {
	return "url('".$match[1]."')";
} else {
	return "url('./.'.'./.'.'./.'.'./.'.'./".ltrim($match[1], '/')."')";
}

Meanwhile i still hope this is integrated to the core plugin :)
 
I'll post my solution once I have it, I'm thinking I keep the convertUriToAbsoluteUri and then simply replace $requestPaths['fullBasePath'] with the ../'s. That way, I can maintain compatibility with every kind of path :)

I'll be running some tests over the weekend.
 
I'll post my solution once I have it, I'm thinking I keep the convertUriToAbsoluteUri and then simply replace $requestPaths['fullBasePath'] with the ../'s. That way, I can maintain compatibility with every kind of path :)

I'll be running some tests over the weekend.
Awesome, thank you :)
 
Update: Upon further testing, it would appear as if this method does not work. Neither my code nor yours works with the default style, so I will have to revert this change. Please feel free to continue to apply your file edit to the files, but I will unfortunately not be able to include this feature in the core product.

If there's even a chance that this could break for some users, I can't in good conscience include the change. Sorry :(
 
Update: Upon further testing, it would appear as if this method does not work. Neither my code nor yours works with the default style, so I will have to revert this change. Please feel free to continue to apply your file edit to the files, but I will unfortunately not be able to include this feature in the core product.

If there's even a chance that this could break for some users, I can't in good conscience include the change. Sorry :(
Okay thank you for trying.
But i use default style. Just saying.
 
Update: Upon further testing, it would appear as if this method does not work. Neither my code nor yours works with the default style, so I will have to revert this change. Please feel free to continue to apply your file edit to the files, but I will unfortunately not be able to include this feature in the core product.

If there's even a chance that this could break for some users, I can't in good conscience include the change. Sorry :(
You are right, i pasted the wrong code here :)

Here is the correct one :
PHP:
 DBO - Pastebin.com[/url]
 
Last edited:
That code is identical to what you posted at first, and it still doesn't work for me, sorry.
 
That code is identical to what you posted at first, and it still doesn't work for me, sorry.

nope it's not identical :)
mine is separated with single quotes.

what i wrote previously :
PHP:
return "url('./.'.'./.'.'./.'.'./.'.'./".ltrim($match[1], '/')."')";

It should be (notice i use double quotes instead of single quotes)
PHP:
return "url('./."."./."."./."."./."."./".ltrim($match[1], '/')."')";

I separated by quotes because a mod security in dragonbyte-tech.com prevent me & banned my IP from posting multiple "../"
 
I would strip those quotes before adding them to the code, thereby making both sets identical :)
 
Hello semprot,

This ticket has now been closed with the status Answered.

We hope your issue or question has been addressed to your satisfaction. If not, please feel free to re-open it by clicking this link.

If you have any further issues or questions, please feel free to start a new support ticket via the button at the top of every page.

Thank you!
 
Status
Not open for further replies.

Legacy DragonByte Optimise

XenForo 1.5.3+
Seller
DragonByte Technologies
Release date
Last update
Total downloads
258
Customer rating
0.00 star(s) 0 ratings
Back
Top