Skip to content

Commit 7faf0e6

Browse files
committed
Fix Video nodes not saving duration
1 parent b61353a commit 7faf0e6

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/components/file/media/detect-existing-media.migration.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export class DetectExistingMediaMigration extends BaseMigration {
1717

1818
async up() {
1919
await this.fixVideoLabels();
20+
await this.fixVideoBuggedDuration();
2021
await this.dropAllDuplicatedMedia();
2122

2223
const detect = async (f: FileVersion) => {
@@ -90,6 +91,14 @@ export class DetectExistingMediaMigration extends BaseMigration {
9091
`.executeAndLogStats();
9192
}
9293

94+
private async fixVideoBuggedDuration() {
95+
await this.db.query().raw`
96+
match (v:Video)
97+
where v.duration is null
98+
set v.duration = 0
99+
`.executeAndLogStats();
100+
}
101+
93102
private async dropAllDuplicatedMedia() {
94103
await this.db.query().raw`
95104
match (fv:FileVersion)-->(media:Media)

src/components/file/media/media.repository.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const toDbShape = (input: Partial<AnyMedia>) => ({
126126
? input.dimensions
127127
: // If not visual, ensure dimensions get cleared
128128
{ width: null, height: null }),
129-
...(input.__typename === 'Audio'
129+
...(input.__typename === 'Audio' || input.__typename === 'Video'
130130
? { duration: input.duration }
131131
: // If not temporal, ensure duration gets cleared
132132
{ duration: null }),

0 commit comments

Comments
 (0)