diff options
Diffstat (limited to 'server/models/video/video-channel.ts')
-rw-r--r-- | server/models/video/video-channel.ts | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index 67fccab68..306bc6ade 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts | |||
@@ -130,13 +130,16 @@ export type SummaryOptions = { | |||
130 | for (const handle of options.handles || []) { | 130 | for (const handle of options.handles || []) { |
131 | const [ preferredUsername, host ] = handle.split('@') | 131 | const [ preferredUsername, host ] = handle.split('@') |
132 | 132 | ||
133 | const sanitizedPreferredUsername = VideoChannelModel.sequelize.escape(preferredUsername.toLowerCase()) | ||
134 | const sanitizedHost = VideoChannelModel.sequelize.escape(host) | ||
135 | |||
133 | if (!host || host === WEBSERVER.HOST) { | 136 | if (!host || host === WEBSERVER.HOST) { |
134 | or.push(`("preferredUsername" = ${VideoChannelModel.sequelize.escape(preferredUsername)} AND "serverId" IS NULL)`) | 137 | or.push(`(LOWER("preferredUsername") = ${sanitizedPreferredUsername} AND "serverId" IS NULL)`) |
135 | } else { | 138 | } else { |
136 | or.push( | 139 | or.push( |
137 | `(` + | 140 | `(` + |
138 | `"preferredUsername" = ${VideoChannelModel.sequelize.escape(preferredUsername)} ` + | 141 | `LOWER("preferredUsername") = ${sanitizedPreferredUsername} ` + |
139 | `AND "host" = ${VideoChannelModel.sequelize.escape(host)}` + | 142 | `AND "host" = ${sanitizedHost}` + |
140 | `)` | 143 | `)` |
141 | ) | 144 | ) |
142 | } | 145 | } |
@@ -698,8 +701,10 @@ export class VideoChannelModel extends Model<Partial<AttributesOnly<VideoChannel | |||
698 | model: ActorModel, | 701 | model: ActorModel, |
699 | required: true, | 702 | required: true, |
700 | where: { | 703 | where: { |
701 | preferredUsername: name, | 704 | [Op.and]: [ |
702 | serverId: null | 705 | ActorModel.wherePreferredUsername(name), |
706 | { serverId: null } | ||
707 | ] | ||
703 | }, | 708 | }, |
704 | include: [ | 709 | include: [ |
705 | { | 710 | { |
@@ -723,9 +728,7 @@ export class VideoChannelModel extends Model<Partial<AttributesOnly<VideoChannel | |||
723 | { | 728 | { |
724 | model: ActorModel, | 729 | model: ActorModel, |
725 | required: true, | 730 | required: true, |
726 | where: { | 731 | where: ActorModel.wherePreferredUsername(name), |
727 | preferredUsername: name | ||
728 | }, | ||
729 | include: [ | 732 | include: [ |
730 | { | 733 | { |
731 | model: ServerModel, | 734 | model: ServerModel, |