mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-06 05:35:19 +02:00
chore: Fix recursive call in getBackgroundImages when encountering empty folder placeholder
This commit is contained in:
parent
2f5bdc052d
commit
8eb9f11708
1 changed files with 5 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
import { ensureBucketExists, getObjectUrl, s3Client } from "$lib/server/s3";
|
import { ensureBucketExists, getObjectUrl, s3Client } from "$lib/server/s3";
|
||||||
import { ListObjectsV2Command } from "@aws-sdk/client-s3";
|
import { ListObjectsV2Command } from "@aws-sdk/client-s3";
|
||||||
|
|
||||||
export const getBackgroundImages = async () => {
|
export const getBackgroundImages = async (): Promise<string> => {
|
||||||
await ensureBucketExists("backgrounds");
|
await ensureBucketExists("backgrounds");
|
||||||
|
|
||||||
const data = await s3Client.send(
|
const data = await s3Client.send(
|
||||||
|
@ -13,6 +13,10 @@ export const getBackgroundImages = async () => {
|
||||||
|
|
||||||
const randomImage = randomImages[randomIndex];
|
const randomImage = randomImages[randomIndex];
|
||||||
|
|
||||||
|
if (randomImage == ".emptyFolderPlaceholder") {
|
||||||
|
return getBackgroundImages();
|
||||||
|
}
|
||||||
|
|
||||||
console.log(randomImage);
|
console.log(randomImage);
|
||||||
|
|
||||||
let url = getObjectUrl("backgrounds", randomImage as string);
|
let url = getObjectUrl("backgrounds", randomImage as string);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue