project Websites / Gitlab Issue Listing Script avatar

websites/Gitlab-Issue-Listing-Script#31: Broken project avatars



Issue Information

Issue Type: issue
Status: closed
Reported By: btasker
Assigned To: btasker

Milestone: v0.4
Created: 21-Apr-22 07:38



Description

Avatars are broken on a couple of projects

Screenshot_20220421_083748

They were automatically mirrored into Gitlab from Github, so have picked up avatars automatically.



Toggle State Changes

Activity


assigned to @btasker

The anchor has ended up as

<img class="projavatar-projlist" src="/avatars/-/avatar">

Looking in Gitlab the path to the avatar is /github-mirror/mod_bgithub_feed/-/avatar whereas a manually set avatar tends to be /uploads/-/system/project/avatar/30/eagle_black_large_trans.png

So, we need to look at handling for that - the most important thing is not showing broken images, so we either need to disable avatars of that form or we need to be able to display them.

Displaying them is liable to cause some headaches though. It'll work fine when GILS is accessed directly (because we can pass the Content-Type header through), but if it's viewed via a wget mirror it's likely to upset some browsers - with no file extension it'll likely get served as application/octet-stream and not display.

I guess though, the bulk of the work is detecting the URLs in the first place - rewriting them for proxying through shouldn't be too much effort, so we can try and see how a static mirror fares.

verified

mentioned in commit 582e0eab6563236bc0883c6b8daba793483f5426

Commit: 582e0eab6563236bc0883c6b8daba793483f5426 
Author: B Tasker                            
                            
Date: 2022-04-21T08:54:27.000+01:00 

Message

Construct a different avatar path where the avatar is being pulled from repo metadata. See websites/Gitlab-Issue-Listing-Script#31

+24 -3 (27 lines changed)
verified

mentioned in commit 1aebbaf48550852b8ccc7154fd1d7ccd9f52e8a9

Commit: 1aebbaf48550852b8ccc7154fd1d7ccd9f52e8a9 
Author: B Tasker                            
                            
Date: 2022-04-21T08:59:46.000+01:00 

Message

Add router side support for avatars served from repo metadata - websites/Gitlab-Issue-Listing-Script#31

+12 -1 (13 lines changed)

The functionality is in place and working.

As Avatar URLs are constructed in a dedicated function (rather than the main SEF ones), we could try and figure out the filename extension by making an API call for the object and checking it's content type header.

That'd work around the mirroring issues

verified

mentioned in commit 088a5f006cf91d6615031e842d38509b797f1320

Commit: 088a5f006cf91d6615031e842d38509b797f1320 
Author: B Tasker                            
                            
Date: 2022-04-21T09:18:31.000+01:00 

Message

Introduce an API call so we can use the correct filename extension websites/Gitlab-Issue-Listing-Script#31

+53 -6 (59 lines changed)

This is in place.

We probably do want to be thinking more about API request caching now though, as this has just introduced an additional per-avatar request for any page displaying avatars drawn from repo metadata.