Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 68c2185

Browse files
Merge pull request #320 from deckgo/screenshot-folder-root
breaking(#319): save screen shot in user new root folder
2 parents 4d0a7bb + cccef2c commit 68c2185

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cloud/functions/src/watch/screenshot/generate-deck-screenshot.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ export async function generateDeckScreenshot(change: Change<DocumentSnapshot>) {
1717
return;
1818
}
1919

20+
if (!newValue.owner_id || newValue.owner_id === undefined || newValue.owner_id === '') {
21+
return;
22+
}
23+
2024
const update: boolean = await needScreenshot(previousValue, newValue);
2125

2226
if (!update) {
@@ -137,7 +141,7 @@ function saveScreenshot(deckData: DeckData, imageBuffer: string): Promise<string
137141
// path[0] = ''
138142
// path[1] = user
139143
// path[2] = presentation-name
140-
const file = bucket.file(`/${path[1]}/${Resources.Constants.PRESENTATION.FOLDER}/${path[2]}/${Resources.Constants.PRESENTATION.IMAGE}`);
144+
const file = bucket.file(`/${deckData.owner_id}/${Resources.Constants.PRESENTATION.FOLDER}/${path[2]}/${Resources.Constants.PRESENTATION.IMAGE}`);
141145

142146
try {
143147
await file.save(imageBuffer);

0 commit comments

Comments
 (0)