missions s3
This commit is contained in:
parent
46ed11bd32
commit
2be6e130e9
15
lib/s3.ts
15
lib/s3.ts
@ -256,7 +256,20 @@ export function getPublicUrl(filePath: string): string {
|
||||
// Remove leading slash if present
|
||||
const cleanPath = filePath.startsWith('/') ? filePath.substring(1) : filePath;
|
||||
|
||||
// Construct the full URL
|
||||
// Special handling for paths that start with 'pages/'
|
||||
if (cleanPath.startsWith('pages/')) {
|
||||
// For paths with pages/ prefix, use a different URL format
|
||||
const minioBaseUrl = process.env.NEXT_PUBLIC_MINIO_BASE_URL || process.env.MINIO_PUBLIC_URL;
|
||||
|
||||
if (minioBaseUrl) {
|
||||
const trimmedBaseUrl = minioBaseUrl.replace(/\/$/, ''); // Remove trailing slash if present
|
||||
const publicUrl = `${trimmedBaseUrl}/${cleanPath}`;
|
||||
console.log('Generated special public URL for pages path:', publicUrl);
|
||||
return publicUrl;
|
||||
}
|
||||
}
|
||||
|
||||
// Construct the full URL using the standard approach
|
||||
const endpoint = S3_CONFIG.endpoint?.replace(/\/$/, ''); // Remove trailing slash if present
|
||||
const bucket = S3_CONFIG.bucket;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user