mezzanine icon indicating copy to clipboard operation
mezzanine copied to clipboard

[BUG] Bleach 6.0.0 breaks escape method at mezzanine/utils/html.py

Open dbeltra opened this issue 2 years ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing Issues

Current Behavior

When trying to save a rich text page you get the following error:

TypeError: unsupported operand type(s) for +: 'frozenset' and 'list'

Expected Behavior

The page should be saved without errors

Steps To Reproduce

  1. Install Mezzanine 6.0.0 and bleach 6.0.0
  2. Create a new project and try to save a page

Environment

* Mezzanine 6.0.0
* Django 4.1.7
* Python 3.8.13
* SQLite 3.38.5
* Darwin 21.4.0

Anything else?

On the latest bleach release, ALLOWED_PROTOCOLS has been changed from list to a frozenset, this is the specific commit: https://github.com/mozilla/bleach/commit/29231a10eb983e25b59c8edc5b6abcb12dbaaabe

This makes this code (https://github.com/stephenmcd/mezzanine/blob/master/mezzanine/utils/html.py#L113) crash: protocols=ALLOWED_PROTOCOLS + ["tel"] since lists and frozensets can't be added

Downgrading to bleach==5.0.1 fixes the issue.

dbeltra avatar Feb 28 '23 07:02 dbeltra

Yup, ran into this one too.

Dziugas avatar Apr 25 '23 13:04 Dziugas

Yep same

andr0s avatar May 05 '23 09:05 andr0s

I just changed line 113 to this and it seems to work so far: protocols=list(ALLOWED_PROTOCOLS) + ["tel"],

LordVan avatar Jun 26 '23 14:06 LordVan

Same env same bug, found LordVan's write up here and it fixed it:

https://blog.lordvan.com/blog/upgrading-mezzanine-forced-to-due-to-move-to-python310/

Maybe worth a PR? Or is there a good reason we can't list() this?

v6 avatar Sep 23 '24 03:09 v6