Generic user icon instead of 404 when avatar not found.
authorArt Cancro <ajc@citadel.org>
Thu, 29 Jun 2023 22:03:34 +0000 (18:03 -0400)
committerArt Cancro <ajc@citadel.org>
Thu, 29 Jun 2023 22:03:34 +0000 (18:03 -0400)
Doing a 404 and then substituting a font-awesome icon makes it 404 over and over and over again.
This is better.

webcit-ng/server/user_functions.c
webcit-ng/static/images/generic-user-icon-32px.png [new file with mode: 0644]

index 0b4548ec3e9696a1d593f0b5388ec0c2c90f6bc2..de4233dfbf774c9f7931efa83209abbaac2ce97d 100644 (file)
@@ -37,7 +37,11 @@ void fetch_user_photo(struct http_transaction *h, struct ctdlsession *c, char *u
                return;
        }
 
-       do_404(h);
+       // The user has no avatar on file.  Redirect to a generic avatar.
+       http_redirect(h, "/ctdl/s/images/generic-user-icon-32px.png");
+
+       // Sending a 404 makes the browser request the same thing over and over again.
+       // do_404(h);
 }
 
 
diff --git a/webcit-ng/static/images/generic-user-icon-32px.png b/webcit-ng/static/images/generic-user-icon-32px.png
new file mode 100644 (file)
index 0000000..4714922
Binary files /dev/null and b/webcit-ng/static/images/generic-user-icon-32px.png differ