diff options
Diffstat (limited to 'server/models/video/video-query-builder.ts')
-rw-r--r-- | server/models/video/video-query-builder.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/server/models/video/video-query-builder.ts b/server/models/video/video-query-builder.ts index 984b0e6af..466890364 100644 --- a/server/models/video/video-query-builder.ts +++ b/server/models/video/video-query-builder.ts | |||
@@ -327,7 +327,7 @@ function buildListQuery (model: typeof Model, options: BuildVideosQueryOptions) | |||
327 | attributes.push('COALESCE("video"."originallyPublishedAt", "video"."publishedAt") AS "publishedAtForOrder"') | 327 | attributes.push('COALESCE("video"."originallyPublishedAt", "video"."publishedAt") AS "publishedAtForOrder"') |
328 | } | 328 | } |
329 | 329 | ||
330 | order = buildOrder(model, options.sort) | 330 | order = buildOrder(options.sort) |
331 | suffix += `${order} ` | 331 | suffix += `${order} ` |
332 | } | 332 | } |
333 | 333 | ||
@@ -357,7 +357,7 @@ function buildListQuery (model: typeof Model, options: BuildVideosQueryOptions) | |||
357 | return { query, replacements, order } | 357 | return { query, replacements, order } |
358 | } | 358 | } |
359 | 359 | ||
360 | function buildOrder (model: typeof Model, value: string) { | 360 | function buildOrder (value: string) { |
361 | const { direction, field } = buildDirectionAndField(value) | 361 | const { direction, field } = buildDirectionAndField(value) |
362 | if (field.match(/^[a-zA-Z."]+$/) === null) throw new Error('Invalid sort column ' + field) | 362 | if (field.match(/^[a-zA-Z."]+$/) === null) throw new Error('Invalid sort column ' + field) |
363 | 363 | ||