mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 01:10:14 +01:00
Addressing eslint errors
This commit is contained in:
parent
a77ad276f1
commit
b6de2a8557
4 changed files with 47 additions and 46 deletions
|
|
@ -19,6 +19,7 @@ export const useClientSideResize = () => {
|
|||
});
|
||||
|
||||
// Safe access to clientSideImageResize config with fallbacks
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
const config = (fileConfig as any)?.clientSideImageResize ?? {
|
||||
enabled: false,
|
||||
maxWidth: 1900,
|
||||
|
|
@ -66,7 +67,6 @@ export const useClientSideResize = () => {
|
|||
return { file: result.file, resized: true, result };
|
||||
} catch (error) {
|
||||
console.warn('Client-side image resizing failed:', error);
|
||||
// Return original file on error
|
||||
return { file, resized: false };
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ function calculateDimensions(
|
|||
maxWidth: number,
|
||||
maxHeight: number,
|
||||
): { width: number; height: number } {
|
||||
let { width, height } = { width: originalWidth, height: originalHeight };
|
||||
const { width, height } = { width: originalWidth, height: originalHeight };
|
||||
|
||||
// If image is smaller than max dimensions, don't upscale
|
||||
if (width <= maxWidth && height <= maxHeight) {
|
||||
|
|
@ -196,7 +196,8 @@ export function shouldResizeImage(
|
|||
fileSizeLimit: number = 512 * 1024 * 1024, // 512MB default
|
||||
): boolean {
|
||||
// Don't resize if file is already small
|
||||
if (file.size < fileSizeLimit * 0.1) { // Less than 10% of limit
|
||||
if (file.size < fileSizeLimit * 0.1) {
|
||||
// Less than 10% of limit
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue