Skip to content

Commit d18d504

Browse files
author
Stephan Krinetzki
committed
fix: search_handler yields bytes and handle None in entity_extended_display
- search_handler yielded str from dumps() instead of bytes, causing TypeError in gunicorn when streaming search results - entity_extended_display could return None for display/info causing AttributeError on .strip() when searching for SPs Tested on pyFF 2.1.5 with gunicorn 25.1.0 and Python 3.12
1 parent b619d50 commit d18d504

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/pyff/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ def _response() -> Generator[bytes, bytes, None]:
462462
for e in entities:
463463
if in_loop:
464464
yield b','
465-
yield dumps(e)
465+
yield dumps(e).encode('utf-8')
466466
in_loop = True
467467
yield b']'
468468

src/pyff/samlmd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ def entity_extended_display(entity, langs=None):
841841
if info == entity.get('entityID'):
842842
info = ''
843843

844-
return display.strip(), info.strip()
844+
return (display or '').strip(), (info or '').strip()
845845

846846

847847
def entity_display_name(entity: Element, langs=None) -> str:

0 commit comments

Comments
 (0)