我正在尝试将附件文件从 youtrack 发送到另一个系统(在此示例中发送到 trello),但不使用图像 url 而是其内容
我无法在 youtrack 中将其作为图片 url 发送,因为我的系统已关闭,只有拥有 vpn 的人才能访问。
问题在于从工作流中的附件内容读取 inputStream。我不知道该怎么做,你的跟踪文档也没有触及它(就我的研究而言)
代码:(截断了不重要的部分)
//...
exports.rule = entities.Issue.onChange({
//...
action: function(ctx) {
//...
var link = '/1/cards/' + issue['trelloIssueId'] + '/attachments';
issue.comments.added.forEach(function(comment) {
comment.attachments.forEach(function(attachment) {
var response = connection.postSync(link, {
name: attachment.name,
file: attachment.content,
mimeType: attachment.mimeType
});
//...
});
});
},
requirements: {}
});
从这里我得到错误:
TypeError: invokeMember (forEach) on jetbrains.youtrack.workflow.sandbox.InputStreamWrapper@677a561f failed due to: Unknown identifier: forEach
我必须如何准备内容才能使用 postSync 方法发送?
答案 0 :(得分:0)
看起来您试图迭代 issue.comments.added
而循环应该在 issue.comments
上执行,因为问题的评论 added
没有 Set
键,根据以下文档页面建议:https://www.jetbrains.com/help/youtrack/devportal/v1-Issue.html
如果可行,请告诉我。