mirror of
https://github.com/wekan/wekan.git
synced 2025-04-23 13:37:09 -04:00
Fix missing profile/avatar pictures.
Thanks to kovacs-andras and xet7 ! Fixes #5147
This commit is contained in:
parent
2ab5009de7
commit
4e97a5351a
1 changed files with 12 additions and 0 deletions
|
@ -1888,6 +1888,18 @@ if (Meteor.isServer) {
|
|||
Users._collection.createIndex({
|
||||
modifiedAt: -1,
|
||||
});
|
||||
// Avatar URLs from CollectionFS to Meteor-Files, at users collection avatarUrl field:
|
||||
Users.find({ "profile.avatarUrl": { $regex: "/cfs/files/avatars/" } }).forEach(function (doc) {
|
||||
doc.profile.avatarUrl = doc.profile.avatarUrl.replace("/cfs/files/avatars/", "/cdn/storage/avatars/");
|
||||
Users.save(doc);
|
||||
});
|
||||
/* TODO: Optionally, for additional complexity:
|
||||
a) Support SubURLs with parthname from ROOT_URL
|
||||
b) Remove beginning or avatar URL, replace it with pathname and new avatar URL
|
||||
c) Does all avatar and attachment URLs need to be fixed every time when starting or restarting?
|
||||
d) What if avatar URL is at some other server? In that case, links would point incorrectly to this instance, if ROOT_URL and path part is removed.
|
||||
doc.profile.avatarUrl = process.env.ROOT_URL.pathname + doc.profile.avatarUrl.replace("/cfs/files/avatars/", "/cdn/storage/avatars/").substring(str.indexOf("/cdn/storage/avatars"));
|
||||
*/
|
||||
/* Commented out extra index because of IndexOptionsConflict.
|
||||
Users._collection.createIndex(
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue