@adventurelabs/scout-core 1.0.126 → 1.0.127
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/helpers/storage.js +8 -3
- package/package.json +1 -1
package/dist/helpers/storage.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use server";
|
|
2
2
|
import { newServerClient } from "../supabase/server";
|
|
3
|
-
import {
|
|
3
|
+
import { SIGNED_URL_EXPIRATION_SECONDS, } from "../constants/db";
|
|
4
4
|
/**
|
|
5
5
|
* Splits file path into bucket name and path. Must be at leaast one slash in your file path
|
|
6
6
|
* @param filePath
|
|
@@ -49,9 +49,14 @@ export async function generateSignedUrlsBatch(filePaths, expiresIn = SIGNED_URL_
|
|
|
49
49
|
const supabase = supabaseClient || (await newServerClient());
|
|
50
50
|
const signedUrlPromises = filePaths.map(async (filePath) => {
|
|
51
51
|
try {
|
|
52
|
+
const parts = getPartsFromFilePath(filePath);
|
|
53
|
+
if (!parts) {
|
|
54
|
+
console.error("Invalid file path:", filePath);
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
52
57
|
const { data, error } = await supabase.storage
|
|
53
|
-
.from(
|
|
54
|
-
.createSignedUrl(
|
|
58
|
+
.from(parts.bucket_name)
|
|
59
|
+
.createSignedUrl(parts.path, expiresIn);
|
|
55
60
|
if (error) {
|
|
56
61
|
console.error(`Error generating signed URL for ${filePath}:`, error.message);
|
|
57
62
|
return null;
|