Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken image display for address book contacts in drop down menu #3078

Closed
arnowelzel opened this issue Oct 23, 2022 · 27 comments
Closed

Broken image display for address book contacts in drop down menu #3078

arnowelzel opened this issue Oct 23, 2022 · 27 comments
Labels

Comments

@arnowelzel
Copy link

Describe the bug

I notized this issue after upgrading from Nextcloud 24 to Nextcloud 25, but maybe this also happens with Nextcloud 24:

When opening the contact menu, images for contacts who don't have an image show as "broken image" and not using the initials as placolder. In the following screenshot the "C" and "D" are users in Nextcloud. All other entries are just address book contacts without image

image

The reason for this is, that the respective image URLs (e.g. https://myserver.example/avatar/a5db8598-935c-4935-8ac7-02d89f1226e6/64&size=64) result in 404 errors.

Steps to reproduce

  1. Make sure that the Contacts app is installed and active
  2. Create some address book entries without image
  3. Click on the "contacts" icon on the top right corner to display the contact drop down menu

Expected behavior

Address book contacts without image show a placholder similar to user entries based on the first and last name.

Actual behavior

A "broken image" is displayed since the image URL responds with a 404 error.

Contact version

5.0.1

Operating system

Ubuntu Linux 20.04.5 LTS

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database

MariaDB

Additional info

No response

@plutocrat
Copy link

Can confirm. No contact images displaying anywhere in Nextcloud web app. Not in dropdown, not in contacts app.
Identical synced contacts display fine in Thunderbird / Cardbook.
PHP 8.0, Nextcloud versions 24 and also 25. Ubuntu 20.04. Was previously working but I don't use the web interface much, so couldn't say exactly when it broke.

@nicokaiser
Copy link
Contributor

In the contact app, the 404 errors are also present (seems like the app makes HTTP request for each and every contact to check if there is an image), but a placeholder image is displayed correctly.
This is broken in the dropdown menu.

@arnowelzel
Copy link
Author

Well - generating dozens or hundreds of requests which end in 404 errors is not a good design. If the contact app wants to load an image for a contact, then this should either be the stored image or a generated placeholder similar to how it is done for users. But the way how this seems to be implemented at the moment is really not very good.

Having many 404 errors also triggers alerts in the server monitoring and it is hard to see if there is a real problem with the server or just the odd behaviour of the contacts app.

@SKB-CGN
Copy link

SKB-CGN commented Nov 15, 2022

Same problem here. Even https://server.com/apps/contacts/css/icons.css?v=19bbdecf-15](https://cloud.kreyenborg.koeln/apps/contacts/css/icons.css?v=19bbdecf-15)" wurde wegen eines MIME-Typ-Konfliktes ("text/html") blockiert (X-Content-Type-Options: nosniff).

@dneuhaeuser
Copy link

I also have this problem with contacts of federated servers.

image

The avatar is trying to load from my local nextcloud installation instead of the federated installation:
https://cloud.myserver.de/index.php/avatar/christian......./64&size=32

should be:
https://cloud.myfederation.de/index.php/avatar/christian......./64&size=32

@plutocrat
Copy link

Just tried something new: Found a contact without an image in the NC web interface. Added Image, which didn't display anywhere in contacts app or dropdown. Synched contact to phone and email client, where the image displays correctly.

Lots of errors in this format as previously stated.
https://myserver.example/avatar/a5db8598-935c-4935-8ac7-02d89f1226e6/64&size=64

@summersab
Copy link

I can confirm that this is a bug. I just spun up a fresh instance of NC with a SQLite DB, and any new contact has a broken image while users have the default avatars with their initials. While tracing the code, I actually think that this issue has to do with the core user libraries. The failure occurs here:
https://github.com/nextcloud/server/blob/ec5cbdeb7ffb87c0169c39e6f44846e819b41f14/lib/private/Avatar/AvatarManager.php#L114

I'm going to open an issue in the server repo referencing this.

@arnowelzel
Copy link
Author

I can confirm that this is a bug. I just spun up a fresh instance of NC with a SQLite DB, and any new contact has a broken image while users have the default avatars with their initials. While tracing the code, I actually think that this issue has to do with the core user libraries. The failure occurs here: https://github.com/nextcloud/server/blob/ec5cbdeb7ffb87c0169c39e6f44846e819b41f14/lib/private/Avatar/AvatarManager.php#L114

I'm going to open an issue in the server repo referencing this.

Thanks for that finding! With this information it should not be too hard to fix this.

@summersab
Copy link

I submitted a PR to hopefully fix the issue. Until then, here is a very simple app that solves the problem temporarily:
https://github.com/nunimbus/contacts_avatar_patch

@arnowelzel
Copy link
Author

I submitted a PR to hopefully fix the issue. Until then, here is a very simple app that solves the problem temporarily: https://github.com/nunimbus/contacts_avatar_patch

Thanks a lot! The patch app works fine here to mitigate the problem until the PR is merged and and update is published.

@summersab
Copy link

Glad I could help! I thought the issue had to do with my highly-customized setup, and I spent hours digging into my personal code. It really didn't occur to me that it could be an issue with the core NC libraries. At least there was a simple workaround.

@summersab
Copy link

@arnowelzel I pushed an update to my app. It was throwing errors on a foreach loop because I didn't think I needed to validate that an element is an array. It works without the update, but this will keep your logs quiet.

@arnowelzel
Copy link
Author

@arnowelzel I pushed an update to my app. It was throwing errors on a foreach loop because I didn't think I needed to validate that an element is an array. It works without the update, but this will keep your logs quiet.

Thanks for the update, works fine :-)

@plutocrat
Copy link

plutocrat commented Dec 9, 2022

Broken image problem now fixed with the patch, but contacts which have images in the vcard are still not displaying it. So in both contact app and the quick contact find box, top right, all you can see are the contact initials.
If you export a contact with an image, the base64 encoded image is correctly displayed in the vcf file. VCF version is 3.0 though, whereas original was 4.0. Don't know if that has any effect.

@SKB-CGN
Copy link

SKB-CGN commented Dec 9, 2022

Problem still persistent with new NC 25.0.2

@arnowelzel
Copy link
Author

Broken image problem now fixed with the patch, but contacts which have images in the vcard are still not displaying it. So in both contact app and the quick contact find box, top right, all you can see are the contact initials. If you export a contact with an image, the base64 encoded image is correctly displayed in the vcf file. VCF version is 3.0 though, whereas original was 4.0. Don't know if that has any effect.

The problem is, that the contact drop down menu does not load any avatar images from contacts at all. The patch app only make sure, that this will not result in 404 errors but instead at least placeholders will be used. For me this is ok, since the regular contact list itself works fine though.

Drop down list with a search - the "AA" entry is a contact which has an image but it is not used in the drop down:

image

Contacts app with the same contact - here the image is used:

image

@summersab
Copy link

Hmm... I didn't realize that the app was supposed to grab custom avatars for those contacts who are stored in the address book (vCard/DAV contacts). That makes sense, though. I'll give that a look this week to hopefully update my patch and find the root cause in the NC code.

@arnowelzel
Copy link
Author

Unfortunately the patch app breaks the user profile page in the latest NC version. Also see nunimbus/contacts_avatar_patch#1

Hopefully the original issue gets fixed so the "patch" is not needed any longer.

@plutocrat
Copy link

Issue still present after update to Contacts 5.1 today.

@SKB-CGN
Copy link

SKB-CGN commented Feb 4, 2023

Correct and confirmed after update today.

Inside the app, the pictures are shown - only the quicksearch does not display the pictures.

@flurmind
Copy link

flurmind commented Feb 4, 2023

Confirmed!

@user592965
Copy link

Same problem here with Contacts 5.1 and NC 25.0.3

@SKB-CGN
Copy link

SKB-CGN commented Feb 17, 2023

I just installed the new 26.0.0 beta 4 and enabled the contacts app, which is now marked as "untested app".

What shall i say?

Contacts are working as you can see in the image:

2023-02-17 12_55_16-Window

@Ravinou
Copy link

Ravinou commented Feb 25, 2023

image

Same with Nextcloud 25.0.4 + contacts 5.1.0

@summersab
Copy link

I haven't kept up - been busy with other stuff. Has anyone tried with NC 26 beta? I might try to look at it soon, but no promises.

@ChristophWurst
Copy link
Member

I don't know the issue/PR but I think this has been addressed recently. Could someone check?

@dhelonious
Copy link

@ChristophWurst You're correct, this was fixed in nextcloud/server#36735.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests