Skip to content

Commit

Permalink
fix realtime
Browse files Browse the repository at this point in the history
  • Loading branch information
tlgimenes committed Apr 5, 2024
1 parent 3000ef8 commit 6e66ebe
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/realtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,13 @@ export class Realtime implements DurableObject {
} else if (isTextFileSet(patch)) {
const { path, content } = patch;
try {
if (content === null) {
await this.fs.unlink(path);
} else {
await this.fs.writeFile(path, content);
}
results.push({ accepted: true, path, content: content ?? "" });
await this.fs.writeFile(path, content ?? "");
results.push({
accepted: true,
path,
content: content ?? "",
deleted: content === null,
});
} catch (error) {
results.push({ accepted: false, path, content: content ?? "" });
}
Expand Down

0 comments on commit 6e66ebe

Please sign in to comment.