21 lines
559 B
JavaScript
21 lines
559 B
JavaScript
const { Errors } = require('../../shared')
|
|
|
|
module.exports = exports = async (message, di) => {
|
|
const Node = di.models.get('fs:Node')
|
|
const { path, name, value } = message.data()
|
|
|
|
const node = await Node.get_path(path, message.socket.session.overlay_name || 'mainline')
|
|
if ( !node ) {
|
|
return message.send_response(
|
|
message.fresh().error(Errors.NodeDoesNotExist)
|
|
)
|
|
}
|
|
|
|
node.set_xattr(name, value)
|
|
await node.save()
|
|
|
|
message.send_response(
|
|
message.fresh().data({ node: node.to_api() })
|
|
)
|
|
}
|