Skip to content

Commit b1c6c04

Browse files
committed
fix guardrails errors
1 parent a85a27f commit b1c6c04

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

browser/components/CodeEditor.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -888,10 +888,7 @@ export default class CodeEditor extends React.Component {
888888
handlePaste (editor, forceSmartPaste) {
889889
const { storageKey, noteKey, fetchUrlTitle, enableSmartPaste } = this.props
890890

891-
const isURL = str => {
892-
const matcher = /^(?:\w+:)?\/\/([^\s\.]+\.\S{2}|localhost[\:?\d]*)\S*$/
893-
return matcher.test(str)
894-
}
891+
const isURL = str => /(?:^\w+:|^)\/\/(?:[^\s\.]+\.\S{2}|localhost[\:?\d]*)/.test(str)
895892

896893
const isInLinkTag = editor => {
897894
const startCursor = editor.getCursor('start')
@@ -1109,7 +1106,7 @@ export default class CodeEditor extends React.Component {
11091106
iconv.encodingExists(_charset)
11101107
? _charset
11111108
: 'utf-8'
1112-
resolve(iconv.decode(new Buffer(buff), charset).toString())
1109+
resolve(iconv.decode(Buffer.from(buff), charset).toString())
11131110
} catch (e) {
11141111
reject(e)
11151112
}

0 commit comments

Comments
 (0)