Skip to content

Commit

Permalink
Merge pull request #2420 from atom-community/ansiFilter.toHtml
Browse files Browse the repository at this point in the history
fix: try catch ansi-to-html
  • Loading branch information
aminya authored Mar 21, 2021
2 parents 9a68bc8 + b9cd891 commit c7adf12
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/script-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,13 @@ export default class ScriptView extends MessagePanelView {
line = _.escape(line);
}

line = this.ansiFilter.toHtml(line);
try {
line = this.ansiFilter.toHtml(line);
} catch (e) {
// TODO why this happens https://github.com/atom-community/atom-script/issues/2358
console.error(e);
}

line = linkPaths(line);

const { clientHeight, scrollTop, scrollHeight } = this.body[0];
Expand Down
9 changes: 9 additions & 0 deletions spec/fixtures/issue_2358.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# See the console after running this

import requests

head = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/65.0.3325.181 Chrome/65.0.3325.181 Safari/537.36'}

r = requests.get('https://www.oxfordlearnersdictionaries.com/us/wordlists/oxford3000-5000', headers=head)

print(r.text)

0 comments on commit c7adf12

Please sign in to comment.