screwdriver-api 8.0.62 → 8.0.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-api",
3
- "version": "8.0.62",
3
+ "version": "8.0.64",
4
4
  "description": "API server for the Screwdriver.cd service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -172,10 +172,12 @@ module.exports = () => ({
172
172
  const newBadges = {};
173
173
 
174
174
  Object.keys(oldPipeline.badges).forEach(badgeKey => {
175
- newBadges[badgeKey] = {
176
- ...oldPipeline.badges[badgeKey],
177
- ...badges[badgeKey]
178
- };
175
+ if (badges[badgeKey] && Object.keys(badges[badgeKey]).length > 0) {
176
+ newBadges[badgeKey] = {
177
+ ...oldPipeline.badges[badgeKey],
178
+ ...badges[badgeKey]
179
+ };
180
+ }
179
181
  });
180
182
 
181
183
  oldPipeline.badges = newBadges;
@@ -72,11 +72,11 @@ const webhooksPlugin = {
72
72
 
73
73
  try {
74
74
  let size = 0;
75
- let data = '';
75
+ const chunks = [];
76
76
 
77
77
  for await (const chunk of request.payload) {
78
78
  size += chunk.length;
79
- data += chunk;
79
+ chunks.push(chunk);
80
80
  if (size > DEFAULT_MAX_BYTES) {
81
81
  throw boom.entityTooLarge(
82
82
  `Payload size exceeds the maximum limit of ${DEFAULT_MAX_BYTES} bytes`
@@ -84,6 +84,7 @@ const webhooksPlugin = {
84
84
  }
85
85
  }
86
86
 
87
+ const data = Buffer.concat(chunks).toString();
87
88
  let parsedPayload;
88
89
 
89
90
  try {