diff --git a/.changeset/grumpy-pants-relax.md b/.changeset/grumpy-pants-relax.md new file mode 100644 index 000000000000..e280758f8369 --- /dev/null +++ b/.changeset/grumpy-pants-relax.md @@ -0,0 +1,7 @@ +--- +"wrangler": patch +--- + +fix: path should be optional for wrangler d1 backup download + +This PR fixes a bug that forces folks to provide a `--output` flag to `wrangler d1 backup download`. diff --git a/packages/wrangler/src/d1/backups.tsx b/packages/wrangler/src/d1/backups.tsx index 64f9841e3e8d..fa428ffbabee 100644 --- a/packages/wrangler/src/d1/backups.tsx +++ b/packages/wrangler/src/d1/backups.tsx @@ -191,11 +191,7 @@ export const DownloadHandler = withConfig( name ); const filename = - output || - path.join( - process.env.INIT_CWD as string, - `${name}.${backupId.slice(0, 8)}.sqlite3` - ); + output || path.resolve(`${name}.${backupId.slice(0, 8)}.sqlite3`); logger.log(`🌀 Downloading backup ${backupId} from '${name}'`); const response = await getBackupResponse(accountId, db.uuid, backupId);