backend-manager 3.2.130 → 3.2.132
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
|
@@ -292,15 +292,18 @@ Module.prototype.uploadPost = function (content) {
|
|
|
292
292
|
const existing = await self.octokit.rest.repos.getContent({
|
|
293
293
|
owner: owner,
|
|
294
294
|
repo: repo,
|
|
295
|
-
path:
|
|
295
|
+
path: filename,
|
|
296
296
|
})
|
|
297
297
|
.catch(e => e);
|
|
298
298
|
|
|
299
299
|
// Log
|
|
300
300
|
assistant.log(`uploadPost(): Existing`, existing);
|
|
301
301
|
|
|
302
|
-
//
|
|
303
|
-
if (
|
|
302
|
+
// Quit if error and it's not a 404
|
|
303
|
+
if (
|
|
304
|
+
existing instanceof Error
|
|
305
|
+
&& existing?.status !== 404
|
|
306
|
+
) {
|
|
304
307
|
return reject(existing);
|
|
305
308
|
}
|
|
306
309
|
|
|
@@ -309,7 +312,7 @@ Module.prototype.uploadPost = function (content) {
|
|
|
309
312
|
owner: owner,
|
|
310
313
|
repo: repo,
|
|
311
314
|
path: filename,
|
|
312
|
-
sha: existing?.data?.sha,
|
|
315
|
+
sha: existing?.data?.sha || undefined,
|
|
313
316
|
message: `📦 admin:create-post:upload-post ${filename}`,
|
|
314
317
|
content: Buffer.from(content).toString('base64'),
|
|
315
318
|
})
|