ComputerScienceHouse / ComputerScienceHouse/gallery

Handle deleted users gracefully

Cerrado
#130 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
22
Forks
30
Merge medio
2 h 26 min
PR fusionados (30 d)
1

Descripción

Currently, if a user account no longer exists, Gallery will fail to render the entire page. Additionally, logging does not show the UUID that searching was attempted for (which is partially a csh_ldap problem), so it is not possible to look at the logs and immediately see the UUID that caused problems.

Proposed solution:
1) add logging to show the UUID that searching breaks on
2) gracefully return that the `author` is either "root" or "disabled" instead of crashing.

Current error trace:
```
File "/opt/gallery/gallery/util.py", line 91, in wrapped_function
return func(*args, **kwargs)
File "/opt/gallery/gallery/__init__.py", line 1076, in render_dir
return render_template("view_dir.html",
children=children,
...<6 lines>...
auth_dict=auth_dict,
lockdown=gallery_lockdown)
File "/opt/gallery/gallery/templates/view_dir.html", line 1, in top-level template code
{% extends "nav.html" %}
File "/opt/gallery/gallery/templates/nav.html", line 1, in top-level template code
{% extends "base.html" %}
File "/opt/gallery/gallery/templates/base.html", line 19, in top-level template code
{% block body %}
File "/opt/gallery/gallery/templates/view_dir.html", line 77, in block 'body'

Owner: {{ ldap.convert_uuid_to_displayname(child.author) }}


File "/opt/gallery/gallery/ldap.py", line 37, in convert_uuid_to_displayname
return self._ldap.get_member(uuid).displayName
~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/usr/local/lib/python3.13/site-packages/csh_ldap/utility.py", line 39, in wrapper
result = method(*method_args, **method_kwargs)
File "/usr/local/lib/python3.13/site-packages/csh_ldap/__init__.py", line 62, in get_member
return CSHMember(self, val, uid)
File "/usr/local/lib/python3.13/site-packages/csh_ldap/utility.py", line 39, in wrapper
result = method(*method_args, **method_kwargs)
File "/usr/local/lib/python3.13/site-packages/csh_ldap/member.py", line 39, in __init__
raise KeyError("Invalid Search Name")
KeyError: 'Invalid Search Name'
```

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comienza con gallery/ldap.py, especialmente con convert_uuid_to_displayname, y con la representación del propietario en templates/view_dir.html; sigue el traceback a través de la búsqueda de miembros en LDAP. Reproduce el caso de un usuario eliminado y verifica que se registre el UUID intentado y que la página se renderice mostrando al autor como "root" o "disabled", en lugar de fallar.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
backend
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
58/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.