use stripTrailingSlash for uriRegex in dupes

This commit is contained in:
mzivil 2024-02-02 15:45:49 -05:00
parent a039f29cdf
commit 068f1e9eba
1 changed files with 2 additions and 3 deletions

View File

@ -1,5 +1,5 @@
import { GraphQLError } from 'graphql'
import { ensureProtocol, removeTracking } from '../../lib/url'
import { ensureProtocol, removeTracking, stripTrailingSlash } from '../../lib/url'
import serialize, { serializeInvoicable } from './serial'
import { decodeCursor, LIMIT, nextCursorEncoded } from '../../lib/cursor'
import { getMetadata, metadataRuleSets } from 'page-metadata-parser'
@ -556,8 +556,7 @@ export default {
pathname = pathname.replace(/%/g, '\\%')
pathname = pathname.replace(/_/g, '\\_')
let uri = hostname + pathname
uri = uri.endsWith('/') ? uri.slice(0, -1) : uri
let uri = stripTrailingSlash(hostname + pathname)
let similar = `(http(s)?://)?${uri}/?`
const whitelist = ['news.ycombinator.com/item', 'bitcointalk.org/index.php']