fix lint errors

This commit is contained in:
mzivil 2024-02-02 16:06:33 -05:00
parent 7ff02ebe30
commit 986ba582e5
2 changed files with 3 additions and 3 deletions

View File

@ -540,7 +540,7 @@ export default {
}, },
dupes: async (parent, { url }, { me, models }) => { dupes: async (parent, { url }, { me, models }) => {
const urlObj = new URL(ensureProtocol(url)) const urlObj = new URL(ensureProtocol(url))
let { hostname, pathname } = urlObj const { hostname, pathname } = urlObj
let hostnameRegex = hostname + '(:[0-9]+)?' let hostnameRegex = hostname + '(:[0-9]+)?'
const parseResult = parse(urlObj.hostname) const parseResult = parse(urlObj.hostname)
@ -556,7 +556,7 @@ export default {
pathnameRegex = pathnameRegex.replace(/%/g, '\\%') pathnameRegex = pathnameRegex.replace(/%/g, '\\%')
pathnameRegex = pathnameRegex.replace(/_/g, '\\_') pathnameRegex = pathnameRegex.replace(/_/g, '\\_')
let uriRegex = stripTrailingSlash(hostnameRegex + pathnameRegex) const uriRegex = stripTrailingSlash(hostnameRegex + pathnameRegex)
let similar = `(http(s)?://)?${uriRegex}/?` let similar = `(http(s)?://)?${uriRegex}/?`
const whitelist = ['news.ycombinator.com/item', 'bitcointalk.org/index.php'] const whitelist = ['news.ycombinator.com/item', 'bitcointalk.org/index.php']

View File

@ -23,7 +23,7 @@ export function removeTracking (value) {
return value return value
} }
export function stripTrailingSlash(uri) { export function stripTrailingSlash (uri) {
return uri.endsWith('/') ? uri.slice(0, -1) : uri return uri.endsWith('/') ? uri.slice(0, -1) : uri
} }