1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-08-05 05:05:17 +02:00

chore: Fix recursive call in getBackgroundImages when encountering empty folder placeholder

This commit is contained in:
Sean Morley 2024-06-12 19:49:55 +00:00
parent 2f5bdc052d
commit 8eb9f11708

View file

@ -1,7 +1,7 @@
import { ensureBucketExists, getObjectUrl, s3Client } from "$lib/server/s3";
import { ListObjectsV2Command } from "@aws-sdk/client-s3";
export const getBackgroundImages = async () => {
export const getBackgroundImages = async (): Promise<string> => {
await ensureBucketExists("backgrounds");
const data = await s3Client.send(
@ -13,6 +13,10 @@ export const getBackgroundImages = async () => {
const randomImage = randomImages[randomIndex];
if (randomImage == ".emptyFolderPlaceholder") {
return getBackgroundImages();
}
console.log(randomImage);
let url = getObjectUrl("backgrounds", randomImage as string);