nextcloud / social

🎉 Social can be used for work, or to connect to the fediverse!
https://apps.nextcloud.com/apps/social
GNU Affero General Public License v3.0
490 stars 59 forks source link

loading avatar fails [master] #740

Open violoncelloCH opened 5 years ago

violoncelloCH commented 5 years ago

Describe the bug

on current master, loading the avatar throws an InvalidResourceException (no matter if the user has an actual avatar set or just has the auto generated one containing the initial letter of his name)

http://nextcloud.local/index.php/apps/social/api/v1/global/actor/avatar?id=http://nextcloud.local/index.php/apps/social/@test
{"status":-1,"exception":"OCA\\Social\\Exceptions\\InvalidResourceException","message":"no avatar for this Actor"}
StCyr commented 5 years ago

I confirm.

Here's (part of) the php exception:

#0 /var/www/nextcloud/apps/social/lib/Service/CacheDocumentService.php(242): substr('avatar', 0, false)
#1 /var/www/nextcloud/apps/social/lib/Service/DocumentService.php(227): OCA\Social\Service\CacheDocumentService->getContentFromCache('avatar')
#2 /var/www/nextcloud/apps/social/lib/Controller/LocalController.php(763): OCA\Social\Service\DocumentService->getFromCache('https://nextclo...', '')
#3 /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php(166): OCA\Social\Controller\LocalController->globalActorAvatar('https://nextclo...')

So, the problem is that $path is equal to avatar in CacheDocumentService.

But, this comes from the DB where local_copy is set to avatar for local accounts:

MariaDB [nextcloud]> select url,id from oc_social_a2_cache_documts where local_copy='avatar';
+---------------------------------------------------------+----------------------------------------------------------------------------------+
| url                                                     | id                                                                               |
+---------------------------------------------------------+----------------------------------------------------------------------------------+
| https://nextcloud.bollu.be/index.php/avatar/cyrille/128 | https://nextcloud.bollu.be/documents/avatar/aef3e6ff-3e18-422a-9f5c-fea3dee205ef |
| https://nextcloud.bollu.be/index.php/avatar/admin/128   | https://nextcloud.bollu.be/documents/avatar/20023d7a-5404-4b65-a0d8-644644409d49 |
+---------------------------------------------------------+----------------------------------------------------------------------------------+

@daita : any idea how to fix this?

violoncelloCH commented 5 years ago

actually I think it could be the frontend sending a wrong request... If I remember correctly this didn't happen with the refactoring of #748