diff --git a/app/imports/api/creature/creatureProperties/methods/copyPropertyToLibrary.js b/app/imports/api/creature/creatureProperties/methods/copyPropertyToLibrary.js index 46e7d024..b46205b9 100644 --- a/app/imports/api/creature/creatureProperties/methods/copyPropertyToLibrary.js +++ b/app/imports/api/creature/creatureProperties/methods/copyPropertyToLibrary.js @@ -132,6 +132,9 @@ function insertNodeFromProperty(propId, ancestors, order, method) { prop.order = order; } + // Clean the props + props = cleanProps(props); + // Insert the props as library nodes LibraryNodes.batchInsert(props); return prop; @@ -186,4 +189,11 @@ function assertSourceLibraryCopyPermission(props, method) { }); } +function cleanProps(props) { + return props.map(prop => { + let schema = LibraryNodes.simpleSchema(prop); + return schema.clean(prop); + }); +} + export default copyPropertyToLibrary;