Skip to content
Open
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'origin/main' into fix/bb-file-bucket-mo…
…ck-phantom-versions

# Conflicts:
#	packages/bb-file-bucket/src/index.mock.ts
  • Loading branch information
xyos committed Nov 8, 2026
commit c193665e0ca040bcca37af27cda5de33f42c9362
27 changes: 1 addition & 26 deletions packages/bb-file-bucket/src/index.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,32 +466,7 @@ export class FileBucket<O extends FileBucketOptions = FileBucketOptions> extends
*/
async listVersions(path: string): Promise<FileVersionInfo[]> {
this.validateKey(path);
const versionsDir = versionsDirFor(this.dataDir, path);
if (!existsSync(versionsDir)) return [];
const entries = readdirSync(versionsDir, { withFileTypes: true })
.filter(e => e.isFile() && isVersionEntry(e.name))
.map(e => e.name);
if (entries.length === 0) return [];

const hasDeleteMarker = existsSync(deleteMarkerPath(this.dataDir, path));
const versions: FileVersionInfo[] = entries.map(versionId => {
const vPath = versionContentPath(this.dataDir, path, versionId);
const stat = statSync(vPath);
return { versionId, lastModified: stat.mtime, size: stat.size, isCurrent: false };
});
// Sort newest first; break ties by version number (descending) for deterministic ordering
versions.sort((a, b) => {
const timeDiff = b.lastModified.getTime() - a.lastModified.getTime();
if (timeDiff !== 0) return timeDiff;
const aNum = parseInt(a.versionId.slice(1), 10);
const bNum = parseInt(b.versionId.slice(1), 10);
return bNum - aNum;
});
// Mark the newest as current (unless there's a delete marker)
if (versions.length > 0 && !hasDeleteMarker) {
versions[0].isCurrent = true;
}
return versions;
return this.readVersions(path);
}

/**
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.