Support Bug in "Websites excluded" functionality

Brettflan

Licensed
Licensed
Joined
Apr 25, 2022
Messages
1
Reaction score
1
In file "src\addons\XenSoluce\DisallowLinks\Service\DisallowLinks.php", line 81:
Code:
            $Websites = str_replace('www.', '', $Websites);
That removes the "www." from the start of a domain name, as clearly intended. As an aside, it would also remove any further instances of "www." in a domain name if there were any, which in extremely rare cases could cause a problem for specific domains (like "www.somethingwww.com" or whatever). But that's not my main point here.
Later, on line 91, where it is checking if the domain name of a specific URL from a post matches the list of allowed domains, it checks this:
Code:
                if(!in_array($url, $WebsitesExcluded))
There and above it doesn't remove any potential "www." from the URL it is currently checking, and it is then checking against the list of allowed domains for an exact match, which will never have the "www." as established above. So any URL being checked which starts with "www." will fail this check even if it shouldn't. So I guess at the very least you'd need to likewise remove any "www." from the URL you're checking before trying to match it against the allowed domains.

I'd also prefer it allowed all subdomains of a specified domain name rather than matching specific subdomains like it does, but for my use case it is trivial to just list each subdomain as a separate URL in the list. No big deal, I do recognize that would be more difficult and potentially problematic to implement due to effectively two-part TLDs like ".co.uk" and such.

It's also a little picky that the "Websites excluded" lists need to be full URLs with "https://" or "http://" (or probably "//") in order for them to work, you can't just put in the bare domain name. At the least it would be nice to indicate this on that option page. I was wondering what format it wanted myself at first as I could find no indication, and I ended up just delving into the code to see what it was actually doing with that.
 
Hello,

In file "src\addons\XenSoluce\DisallowLinks\Service\DisallowLinks.php", line 81:
Code:
            $Websites = str_replace('www.', '', $Websites);
That removes the "www." from the start of a domain name, as clearly intended. As an aside, it would also remove any further instances of "www." in a domain name if there were any, which in extremely rare cases could cause a problem for specific domains (like "www.somethingwww.com" or whatever). But that's not my main point here.
Later, on line 91, where it is checking if the domain name of a specific URL from a post matches the list of allowed domains, it checks this:
Code:
                if(!in_array($url, $WebsitesExcluded))
There and above it doesn't remove any potential "www." from the URL it is currently checking, and it is then checking against the list of allowed domains for an exact match, which will never have the "www." as established above. So any URL being checked which starts with "www." will fail this check even if it shouldn't. So I guess at the very least you'd need to likewise remove any "www." from the URL you're checking before trying to match it against the allowed domains.

I'd also prefer it allowed all subdomains of a specified domain name rather than matching specific subdomains like it does, but for my use case it is trivial to just list each subdomain as a separate URL in the list. No big deal, I do recognize that would be more difficult and potentially problematic to implement due to effectively two-part TLDs like ".co.uk" and such.

It's also a little picky that the "Websites excluded" lists need to be full URLs with "https://" or "http://" (or probably "//") in order for them to work, you can't just put in the bare domain name. At the least it would be nice to indicate this on that option page. I was wondering what format it wanted myself at first as I could find no indication, and I ended up just delving into the code to see what it was actually doing with that.
Thank you for this comment!

I will indeed review it as soon as possible!

Regards, CRUEL-MODZ
 
Top Bottom