Fix referrer filter

7530de87d2 introduced a regression: the
domain parameter in refFilter() contains 'https://', which bypass the
new regex; thus we readd the call to getDomainName().

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
This commit is contained in:
Kevin Decherf 2022-03-20 22:12:40 +01:00
parent ecfc7ea68e
commit bb7d26d19f

View File

@ -1,5 +1,5 @@
import { BROWSERS } from './constants';
import { removeTrailingSlash, removeWWW } from './url';
import { removeTrailingSlash, removeWWW, getDomainName } from './url';
export const urlFilter = (data, { raw }) => {
const isValidUrl = url => {
@ -46,7 +46,8 @@ export const urlFilter = (data, { raw }) => {
};
export const refFilter = (data, { domain, domainOnly, raw }) => {
const regex = new RegExp(`http[s]?://([a-z0-9-]+\\.)*${domain}`);
const domainName = getDomainName(domain);
const regex = new RegExp(`http[s]?://([a-z0-9-]+\\.)*${domainName}`);
const links = {};
const isValidRef = referrer => {