miinideck 0.1.1 → 0.1.2
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/index.js +7 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -264,13 +264,16 @@ async function deploy(args) {
|
|
|
264
264
|
);
|
|
265
265
|
|
|
266
266
|
// 1. signed URL — try as an update first if we've deployed this path before.
|
|
267
|
+
let replacing = Boolean(knownDocId);
|
|
267
268
|
let step1 = await postJson(
|
|
268
269
|
`${api}/api/v1/upload-url`,
|
|
269
|
-
|
|
270
|
+
replacing ? { size, fileKind, replace_doc_id: knownDocId } : { size, fileKind },
|
|
270
271
|
token,
|
|
271
272
|
);
|
|
272
|
-
// The remembered doc
|
|
273
|
-
|
|
273
|
+
// The remembered doc is gone (deleted, or not ours) — fall back to a fresh
|
|
274
|
+
// link instead of erroring, and stop trying to replace it.
|
|
275
|
+
if (!step1.ok && replacing) {
|
|
276
|
+
replacing = false;
|
|
274
277
|
step1 = await postJson(`${api}/api/v1/upload-url`, { size, fileKind }, token);
|
|
275
278
|
}
|
|
276
279
|
if (!step1.ok) die((step1.json && step1.json.error) || `Could not start upload (HTTP ${step1.status}).`);
|
|
@@ -288,7 +291,7 @@ async function deploy(args) {
|
|
|
288
291
|
|
|
289
292
|
// 3. finalize.
|
|
290
293
|
const finalizeBody = { path: storagePath, slug, fileKind, source_filename: sourceFilename };
|
|
291
|
-
if (
|
|
294
|
+
if (replacing) finalizeBody.replace_doc_id = knownDocId;
|
|
292
295
|
// Default the title to the file/folder name (extension stripped), matching the
|
|
293
296
|
// web upload. Custom name via --name; rename later in the dashboard. (On an
|
|
294
297
|
// update/replace the server keeps the existing title, so a manual rename sticks.)
|
package/package.json
CHANGED