Merge pull request #1821 from omnivore-app/fix/times-of-india
Fix sometimes there is extra spaces between sender and email address by checking only the email address
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import { ContentHandler } from '../content-handler'
|
||||
import addressparser from 'addressparser'
|
||||
|
||||
export class IndiaTimesHandler extends ContentHandler {
|
||||
constructor() {
|
||||
@ -13,7 +14,9 @@ export class IndiaTimesHandler extends ContentHandler {
|
||||
dom: Document
|
||||
}): Promise<boolean> {
|
||||
return Promise.resolve(
|
||||
input.from === 'The Times of India <newsletters@timesofindia.com>'
|
||||
addressparser(input.from).some(
|
||||
(e) => e.address === 'newsletters@timesofindia.com'
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -362,7 +362,7 @@ describe('Newsletter email test', () => {
|
||||
const html = load('./test/data/india-times-newsletter.html')
|
||||
const handler = await getNewsletterHandler({
|
||||
html,
|
||||
from: 'The Times of India <newsletters@timesofindia.com>',
|
||||
from: 'The Times of India <newsletters@timesofindia.com>',
|
||||
headers: {},
|
||||
})
|
||||
expect(handler).to.be.instanceOf(IndiaTimesHandler)
|
||||
|
||||
Reference in New Issue
Block a user