X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Factor%2Factor.ts;h=c12dcf63408baade6dc126da947f62b06d6f1d3f;hb=5cad2ca9db9b9d138f8a33058d10b94a9fd50c69;hp=65c53f8f8a01f49decd5ff0b5ae855395da75388;hpb=1c5e49e75284100b7b1fc8b4e73c8ba53fe22e89;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/actor/actor.ts b/server/models/actor/actor.ts index 65c53f8f8..c12dcf634 100644 --- a/server/models/actor/actor.ts +++ b/server/models/actor/actor.ts @@ -1,5 +1,4 @@ import { values } from 'lodash' -import { extname } from 'path' import { literal, Op, Transaction } from 'sequelize' import { AllowNull, @@ -18,7 +17,8 @@ import { UpdatedAt } from 'sequelize-typescript' import { ModelCache } from '@server/models/model-cache' -import { AttributesOnly } from '@shared/core-utils' +import { getLowercaseExtension } from '@shared/core-utils' +import { AttributesOnly } from '@shared/typescript-utils' import { ActivityIconObject, ActivityPubActorType } from '../../../shared/models/activitypub' import { ActorImage } from '../../../shared/models/actors/actor-image.model' import { activityPubContextify } from '../../helpers/activitypub' @@ -496,7 +496,7 @@ export class ActorModel extends Model>> { }, { where, transaction }) } - static loadAccountActorByVideoId (videoId: number): Promise { + static loadAccountActorByVideoId (videoId: number, transaction: Transaction): Promise { const query = { include: [ { @@ -520,7 +520,8 @@ export class ActorModel extends Model>> { } ] } - ] + ], + transaction } return ActorModel.unscoped().findOne(query) @@ -567,7 +568,7 @@ export class ActorModel extends Model>> { let image: ActivityIconObject if (this.avatarId) { - const extension = extname(this.Avatar.filename) + const extension = getLowercaseExtension(this.Avatar.filename) icon = { type: 'Image', @@ -580,7 +581,7 @@ export class ActorModel extends Model>> { if (this.bannerId) { const banner = (this as MActorAPChannel).Banner - const extension = extname(banner.filename) + const extension = getLowercaseExtension(banner.filename) image = { type: 'Image',