Merge pull request #1283 from njfdev/master

Add Filter to Have Direct Referrer
This commit is contained in:
Mike Cao 2022-07-20 14:25:14 -07:00 committed by GitHub
commit ae354ba676
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,13 +50,15 @@ export const refFilter = (data, { domain, domainOnly, raw }) => {
const links = {};
const isValidRef = referrer => {
return (
referrer !== '' && referrer !== null && !referrer.startsWith('/') && !referrer.startsWith('#')
);
return referrer !== null && !referrer.startsWith('/') && !referrer.startsWith('#');
};
const cleanUrl = url => {
try {
if (url === '') {
return 'Direct / None';
}
const { hostname, origin, pathname, searchParams, protocol } = new URL(url);
if (regex.test(url)) {