Skip to content

/image/uid throws an exception when the user doesn't exist #249

@BigSpaceships

Description

@BigSpaceships

I specifically noticed this with resumes where when it tries to load a profile image for someone who I'm assuming has had their username changed or something there's an ldap error. It would probably make sense to check to see if the user exists or not or even just try catch it all and return a 404

Relevant log:

 File "/usr/local/lib/python3.9/site-packages/ddtrace/contrib/internal/flask/wrappers.py", line 93, in wrapper
return func(pin, wrapped, instance, args, kwargs)
File "/usr/local/lib/python3.9/site-packages/ddtrace/contrib/internal/flask/wrappers.py", line 80, in wrapper
return _wrap_call(wrapped, pin, name, span_type=span_type, args=args, kwargs=kwargs)
File "/usr/local/lib/python3.9/site-packages/ddtrace/contrib/internal/flask/wrappers.py", line 57, in _wrap_call
return wrapped(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.9/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/site-packages/ddtrace/contrib/internal/flask/wrappers.py", line 93, in wrapper
return func(pin, wrapped, instance, args, kwargs)
File "/usr/local/lib/python3.9/site-packages/ddtrace/contrib/internal/flask/patch.py", line 534, in _patched_request
return wrapped(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python3.9/site-packages/ddtrace/contrib/internal/flask/wrappers.py", line 66, in patch_func
return _wrap_call(
File "/usr/local/lib/python3.9/site-packages/ddtrace/contrib/internal/flask/wrappers.py", line 57, in _wrap_call
return wrapped(*args, **kwargs)
File "/opt/profiles/profiles/__init__.py", line 175, in image
return get_image(uid)
File "/opt/profiles/profiles/ldap.py", line 412, in get_image
account = ldap_get_member(uid)
File "/opt/profiles/profiles/ldap.py", line 60, in ldap_get_member
raise BadQueryError("invalid user") from kerr
profiles.ldap.BadQueryError: invalid user

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions