emacs-eaf / eaf-browser

A modern, customizable and extensible browser in Emacs
GNU General Public License v3.0
129 stars 26 forks source link

eaf-browser adblock: easylist.txt UnicodeDecodeError #53

Closed swapneils closed 1 year ago

swapneils commented 1 year ago
Traceback (most recent call last):
  File "~\.doom.d\localpackages\emacs-application-framework\core\utils.py", line 52, in on_signal_received
    self._func(obj, *args, **kwargs)
  File "~\.doom.d\localpackages\emacs-application-framework\eaf.py", line 155, in new_buffer
    self.create_buffer(buffer_id, url, module_path, arguments)
  File "~\.doom.d\localpackages\emacs-application-framework\eaf.py", line 170, in create_buffer
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "~/.doom.d/localpackages/emacs-application-framework/app/browser/buffer.py", line 730, in <module>
    raw_rules = f.readlines()
  File "[redacted]\Python310\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 3168: character maps to <undefined>

Describe the bug Opening any browser page results in a UnicodeDecodeError, which the stack trace links to easylist.txt being read in the adblock code.

To Reproduce

  1. Ensure braveblock is installed (to trigger the adblock code)
  2. git pull
  3. ./install-eaf.py --force --app-drop-local-edit
  4. Run emacs and try eaf-browser-open until you get a blank buffer, and a message starting with "Buffer id _____ does not exist" in the minibuffer
  5. Check eaf buffer for error trace

Expected behavior easylist.txt to be read without issues, followed by successfully opening duckduckgo.com

Versions (please complete the following info):

Additional context Patch: Uninstall braveblock package. The current code takes this as a signal to not adblock, which avoids the problematic file-read.

manateelazycat commented 1 year ago

Has fixed, please upgrade eaf-browser