Skip to content

Commit

Permalink
[backport] fix /ocr on newer Node versions
Browse files Browse the repository at this point in the history
  • Loading branch information
retrixe committed Oct 16, 2021
1 parent fb0a376 commit 763592c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions server/bot/imports/tools.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import https from 'https'
import { get } from 'http'
import { parse } from 'url'
import { URL } from 'url'
import { Db } from 'mongodb'
import { Message } from 'eris'

Expand Down Expand Up @@ -78,8 +78,8 @@ export const fetchLimited = async (url: string, limit: number, opts = {}): Promi
return new Promise((resolve, reject) => {
let size = 0
const data: Buffer[] = []
const parsedUrl = parse(url)
const req = (parsedUrl.protocol === 'https:' ? https.get : get)({ ...parse(url), ...opts }, (res) => {
const parsedUrl = new URL(url)
const req = (parsedUrl.protocol === 'https:' ? https.get : get)(parsedUrl, opts, (res) => {
if (!isNaN(+res.headers['content-length']) && +res.headers['content-length'] > byteLimit) {
req.abort()
resolve(false)
Expand Down

0 comments on commit 763592c

Please sign in to comment.