Skip to content

Commit

Permalink
fix: don't try to sanitize null owners
Browse files Browse the repository at this point in the history
  • Loading branch information
KernelDeimos committed Aug 19, 2024
1 parent 3d92d0c commit cb4cab5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/backend/src/om/entitystorage/SetOwnerES.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
const { get_user } = require("../../helpers");
const { AppUnderUserActorType, UserActorType } = require("../../services/auth/Actor");
const { Context } = require("../../util/context");
const { nou } = require("../../util/langutil");
const { BaseES } = require("./BaseES");

class SetOwnerES extends BaseES {
Expand Down Expand Up @@ -64,6 +65,7 @@ class SetOwnerES extends BaseES {
},
async _sanitize_owner (entity) {
let owner = await entity.get('owner');
if ( nou(owner) ) return null;
owner = get_user({ id: owner });
await entity.set('owner', owner);
}
Expand Down
3 changes: 3 additions & 0 deletions src/backend/src/util/langutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const whatis = thing => {
return typeof thing;
};

const nou = v => v === null || v === undefined;

module.exports = {
whatis,
nou,
};

0 comments on commit cb4cab5

Please sign in to comment.