aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-channel.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video/video-channel.ts')
-rw-r--r--server/models/video/video-channel.ts9
1 files changed, 7 insertions, 2 deletions
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts
index 919ec916d..6d70f2aa2 100644
--- a/server/models/video/video-channel.ts
+++ b/server/models/video/video-channel.ts
@@ -10,6 +10,8 @@ import {
10 VideoChannelMethods 10 VideoChannelMethods
11} from './video-channel-interface' 11} from './video-channel-interface'
12import { sendDeleteVideoChannel } from '../../lib/activitypub/send-request' 12import { sendDeleteVideoChannel } from '../../lib/activitypub/send-request'
13import { isVideoChannelUrlValid } from '../../helpers/custom-validators/video-channels'
14import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
13 15
14let VideoChannel: Sequelize.Model<VideoChannelInstance, VideoChannelAttributes> 16let VideoChannel: Sequelize.Model<VideoChannelInstance, VideoChannelAttributes>
15let toFormattedJSON: VideoChannelMethods.ToFormattedJSON 17let toFormattedJSON: VideoChannelMethods.ToFormattedJSON
@@ -65,10 +67,13 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da
65 defaultValue: false 67 defaultValue: false
66 }, 68 },
67 url: { 69 url: {
68 type: DataTypes.STRING, 70 type: DataTypes.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNELS.URL.max),
69 allowNull: false, 71 allowNull: false,
70 validate: { 72 validate: {
71 isUrl: true 73 urlValid: value => {
74 const res = isVideoChannelUrlValid(value)
75 if (res === false) throw new Error('Video channel URL is not valid.')
76 }
72 } 77 }
73 } 78 }
74 }, 79 },