fix lint errors
This commit is contained in:
parent
7ff02ebe30
commit
986ba582e5
@ -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']
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user