|
@@ -1361,14 +1361,16 @@ Migrations.add('migrate-avatars-collectionFS-to-ostrioFiles', () => {
|
|
'original',
|
|
'original',
|
|
'/',
|
|
'/',
|
|
);
|
|
);
|
|
- if (user.profile.avatarUrl.startsWith(old_url)) {
|
|
|
|
- // Set avatar url to new url
|
|
|
|
- Users.direct.update(
|
|
|
|
- { _id: user._id },
|
|
|
|
- { $set: { 'profile.avatarUrl': new_url } },
|
|
|
|
- noValidate,
|
|
|
|
- );
|
|
|
|
- console.log('User avatar updated: ', user._id, new_url);
|
|
|
|
|
|
+ if (user.profile.avatarUrl !== undefined) {
|
|
|
|
+ if (user.profile.avatarUrl.startsWith(old_url)) {
|
|
|
|
+ // Set avatar url to new url
|
|
|
|
+ Users.direct.update(
|
|
|
|
+ { _id: user._id },
|
|
|
|
+ { $set: { 'profile.avatarUrl': new_url } },
|
|
|
|
+ noValidate,
|
|
|
|
+ );
|
|
|
|
+ console.log('User avatar updated: ', user._id, new_url);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
});
|
|
});
|
|
fileObj.remove();
|
|
fileObj.remove();
|