Skip to content

Commit f951fd7

Browse files
authored
Merge pull request #3637 from OpenNeuroOrg/cli/download-draft-fallback
fix(cli): When downloading a dataset with no snapshots, checkout draft branch instead of detached commit
2 parents da3a086 + 44f0917 commit f951fd7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cli/src/commands/download.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ export async function downloadAction(
5353
version = options.version
5454
} else if (!options.draft) {
5555
version = await getLatestSnapshotVersion(datasetId)
56+
if (
57+
version.length === 40 /* sha1 */ || version.length === 64 /* sha256 */
58+
) {
59+
// Commit hash -> get the draft instead
60+
version = undefined
61+
}
5662
}
5763

5864
// Clone the repo

0 commit comments

Comments
 (0)