chore: Fix recursive call in getBackgroundImages when encountering empty folder placeholder
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user