[FIX] base: loading the public user avatar

Prior to saas-15.4, access /web/content/res.users/4/image_128 without
being logged in, there was an internal server error because you cannot
access the public user (id=4) image.

The saas-15.4 branch is unaffected by the bug but it is a good idea to
forward-port the test that was next to the fix merged in prior versions.

Closes #94258

closes odoo/odoo#98201

X-original-commit: 4deb7e373e046844d997ddc0a11999cc12b765d8
Signed-off-by: Julien Castiaux <juc@odoo.com>
Co-authored-by: ypn <ypnwebdev@gmail.com>
This commit is contained in:
Julien Castiaux
2022-08-17 12:44:58 +02:00
co-authored by ypn
parent 4b79788889
commit 6819f2b0d2
@@ -263,6 +263,11 @@ class TestHttpStatic(TestHttpStaticCommon):
assert_content=self.gizeh_data[100:200]
)
def test_static16_public_user_image(self):
public_user = self.env.ref('base.public_user')
res = self.url_open(f'/web/image/res.users/{public_user.id}/image_128?download=1')
self.assertEqual(res.status_code, 404)
class TestHttpStaticCache(TestHttpStaticCommon):
@freeze_time(datetime.utcnow())