Skip to content

Commit 68417e6

Browse files
committed
CCM-10387: fix pw
1 parent e3bc983 commit 68417e6

File tree

2 files changed

+9
-43
lines changed

2 files changed

+9
-43
lines changed

lambdas/backend-api/src/templates/api/validate-letter-template-files.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@ export class ValidateLetterTemplateFilesLambda {
127127
}
128128

129129
const clientOwned = template.owner.startsWith('CLIENT#');
130+
const ownerFromDb = clientOwned ? template.owner.slice(7) : template.owner;
131+
132+
if (owner !== ownerFromDb) {
133+
throw new Error(
134+
'Unexpected mismatch between s3 path and database owner field'
135+
);
136+
}
130137

131138
const downloads = [
132139
this.letterUploadRepository.download(
@@ -177,7 +184,7 @@ export class ValidateLetterTemplateFilesLambda {
177184
log.error('File parsing error:', error);
178185

179186
await this.templateRepository.setLetterValidationResult(
180-
{ id: templateId, owner: template.owner, clientOwned },
187+
{ id: templateId, owner, clientOwned },
181188
versionId,
182189
false,
183190
[],
@@ -192,7 +199,7 @@ export class ValidateLetterTemplateFilesLambda {
192199
const valid = rtl || validateLetterTemplateFiles(pdf, csv);
193200

194201
await this.templateRepository.setLetterValidationResult(
195-
{ id: templateId, owner: template.owner, clientOwned },
202+
{ id: templateId, owner, clientOwned },
196203
versionId,
197204
valid,
198205
pdf.personalisationParameters,

tests/test-team/template-mgmt-e2e-tests/template-mgmt-letter-full.e2e.spec.ts

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ test.describe('letter complete e2e journey', () => {
286286

287287
let userWithProofing: TestUser;
288288
let userWithoutProofing: TestUser;
289-
let userDirectOwner: TestUser;
290289

291290
test.beforeAll(async () => {
292291
userWithProofing = await createAuthHelper().getTestUser(
@@ -295,9 +294,6 @@ test.describe('letter complete e2e journey', () => {
295294
userWithoutProofing = await createAuthHelper().getTestUser(
296295
testUsers.User3.userId
297296
);
298-
userDirectOwner = await createAuthHelper().getTestUser(
299-
testUsers.User7.userId
300-
);
301297
});
302298

303299
test.afterAll(async () => {
@@ -357,41 +353,4 @@ test.describe('letter complete e2e journey', () => {
357353

358354
await submit(page, templateStorageHelper, templateKey);
359355
});
360-
361-
test('Full journey - user-owner', async ({ page }) => {
362-
const testStart = new Date();
363-
364-
await loginAsUser(userDirectOwner, page);
365-
366-
const templateKey = await create(
367-
page,
368-
templateStorageHelper,
369-
userDirectOwner,
370-
'PENDING_PROOF_REQUEST'
371-
);
372-
373-
await continueAfterCreation(page);
374-
375-
const expandedTemplateId = await requestProof(
376-
page,
377-
templateStorageHelper,
378-
templateKey
379-
);
380-
381-
await checkEmail(
382-
expandedTemplateId,
383-
testStart,
384-
'Proof Requested',
385-
'proof-requested-sender'
386-
);
387-
388-
await submit(page, templateStorageHelper, templateKey);
389-
390-
await checkEmail(
391-
expandedTemplateId,
392-
testStart,
393-
'Template Submitted',
394-
'template-submitted-sender'
395-
);
396-
});
397356
});

0 commit comments

Comments
 (0)