Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix video import with long thumbnail url

Chocobozzz2735a154dc77
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 00238f7a1c..7e26176536 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -14,7 +14,7 @@ import { CONFIG, registerConfigChangedHandler } from './config'
// ---------------------------------------------------------------------------
-const LAST_MIGRATION_VERSION = 460
+const LAST_MIGRATION_VERSION = 465
// ---------------------------------------------------------------------------
@@ -291,6 +291,9 @@ const CONSTRAINTS_FIELDS = {
PLUGINS: {
NAME: { min: 1, max: 214 }, // Length
DESCRIPTION: { min: 1, max: 20000 } // Length
+ },
+ COMMONS: {
+ URL: { min: 5, max: 2000 } // Length
}
}
diff --git a/server/initializers/migrations/0465-thumbnail-file-url-length.ts b/server/initializers/migrations/0465-thumbnail-file-url-length.ts
new file mode 100644
index 0000000000..db8c85c292
--- /dev/null
+++ b/server/initializers/migrations/0465-thumbnail-file-url-length.ts
@@ -0,0 +1,27 @@
+import * as Sequelize from 'sequelize'
+
+async function up (utils: {
+ transaction: Sequelize.Transaction,
+ queryInterface: Sequelize.QueryInterface,
+ sequelize: Sequelize.Sequelize,
+ db: any
+}): Promise<void> {
+ {
+ const data = {
+ type: Sequelize.STRING(2000),
+ allowNull: true,
+ defaultValue: null
+ }
+
+ await utils.queryInterface.changeColumn('thumbnail', 'fileUrl', data)
+ }
+}
+
+function down (options) {
+ throw new Error('Not implemented.')
+}
+
+export {
+ up,
+ down
+}
diff --git a/server/models/video/thumbnail.ts b/server/models/video/thumbnail.ts
index f1952dcc1d..e68a6711fe 100644
--- a/server/models/video/thumbnail.ts
+++ b/server/models/video/thumbnail.ts
@@ -1,6 +1,18 @@
import { join } from 'path'
-import { AfterDestroy, AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript'
-import { LAZY_STATIC_PATHS, STATIC_PATHS, WEBSERVER } from '../../initializers/constants'
+import {
+ AfterDestroy,
+ AllowNull,
+ BelongsTo,
+ Column,
+ CreatedAt,
+ DataType,
+ Default,
+ ForeignKey,
+ Model,
+ Table,
+ UpdatedAt
+} from 'sequelize-typescript'
+import { CONSTRAINTS_FIELDS, LAZY_STATIC_PATHS, STATIC_PATHS, WEBSERVER } from '../../initializers/constants'
import { logger } from '../../helpers/logger'
import { remove } from 'fs-extra'
import { CONFIG } from '../../initializers/config'
@@ -41,7 +53,7 @@ export class ThumbnailModel extends Model<ThumbnailModel> {
type: ThumbnailType
@AllowNull(true)
- @Column
+ @Column(DataType.STRING(CONSTRAINTS_FIELDS.COMMONS.URL.max))
fileUrl: string
@AllowNull(true)