Skip to content

Commit

Permalink
handle cases where linkedIn company pages don't have a website
Browse files Browse the repository at this point in the history
  • Loading branch information
eashaw committed Jun 5, 2024
1 parent 0e6f309 commit 8252e7e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion api/helpers/iq/get-enriched.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ module.exports = {
sails.log.info(`Failed to enrich (${emailAddress},${linkedinUrl},${firstName},${lastName},${organization}):`,err);
return undefined;
});
if (matchingCompanyPageInfo) {
if (matchingCompanyPageInfo && matchingCompanyPageInfo.website) {
let parsedCompanyEmailDomain = require('url').parse(matchingCompanyPageInfo.website);
// If a company's website does not include the protocol (https://), url.parse will return null as the hostname, if this happens, we'll use the href value returned instead.
let emailDomain = parsedCompanyEmailDomain.hostname ? parsedCompanyEmailDomain.hostname.replace(sails.config.custom.RX_PROTOCOL_AND_COMMON_SUBDOMAINS,'') : parsedCompanyEmailDomain.href.replace(sails.config.custom.RX_PROTOCOL_AND_COMMON_SUBDOMAINS,'');
Expand Down

0 comments on commit 8252e7e

Please sign in to comment.