fix: cdn routes
This commit is contained in:
		
							parent
							
								
									c511789056
								
							
						
					
					
						commit
						ca272ce8f0
					
				@ -18,10 +18,18 @@ const s3Client = new S3({
 | 
				
			|||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function replaceCDNUrl(url: string) {
 | 
					export function replaceCDNUrl(url: string) {
 | 
				
			||||||
  url = url.replace(
 | 
					  // When using R2, we don't want to include the bucket name in the URL
 | 
				
			||||||
    process.env.SPACES_ENDPOINT!,
 | 
					  if (process.env.SPACES_CDN_DONT_INCLUDE_BUCKET === "true") { 
 | 
				
			||||||
    process.env.SPACES_ENDPOINT_CDN!
 | 
					    url = url.replace(
 | 
				
			||||||
  );
 | 
					      `${process.env.SPACES_ENDPOINT}/${process.env.SPACES_BUCKET}`,
 | 
				
			||||||
 | 
					      process.env.SPACES_ENDPOINT_CDN!
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					    url = url.replace(
 | 
				
			||||||
 | 
					      process.env.SPACES_ENDPOINT!,
 | 
				
			||||||
 | 
					      process.env.SPACES_ENDPOINT_CDN!
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  return url;
 | 
					  return url;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user