ComputerScienceHouse / ComputerScienceHouse/gallery

Handle deleted users gracefully

クローズ
#130 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
22
フォーク
30
平均マージ
2時間 26分
マージ済み PR(30日)
1

説明

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'
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

gallery/ldap.py、特に convert_uuid_to_displayname と、templates/view_dir.html での所有者のレンダリングから始めます。LDAP メンバールックアップを通して traceback を追跡します。削除されたユーザーのケースを再現し、試行された UUID がログに記録され、ページが失敗するのではなく、作成者が "root" または "disabled" として表示されてレンダリングされることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
backend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
58/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。