@@ -158,8 +158,8 @@ async fn static_route_source(mode: NextMode, path: FileSystemPath) -> Result<Vc<
158
158
let file_size_limit_mb = if is_twitter { 5 } else { 8 } ;
159
159
if ( is_twitter || is_open_graph)
160
160
&& let Some ( content) = path. read ( ) . await ?. as_content ( )
161
- && let file_size_mb = content. content ( ) . to_bytes ( ) . len ( ) / 1024 / 1024
162
- && file_size_mb > file_size_limit_mb
161
+ && let file_size = content. content ( ) . to_bytes ( ) . len ( )
162
+ && file_size > ( file_size_limit_mb * 1024 * 1024 )
163
163
{
164
164
StaticMetadataFileSizeIssue {
165
165
img_name : if is_twitter {
@@ -169,7 +169,7 @@ async fn static_route_source(mode: NextMode, path: FileSystemPath) -> Result<Vc<
169
169
} ,
170
170
path : path. clone ( ) ,
171
171
file_size_limit_mb,
172
- file_size_mb ,
172
+ file_size ,
173
173
}
174
174
. resolved_cell ( )
175
175
. emit ( ) ;
@@ -428,7 +428,7 @@ async fn dynamic_image_route_source(path: FileSystemPath) -> Result<Vc<Box<dyn S
428
428
struct StaticMetadataFileSizeIssue {
429
429
img_name : RcStr ,
430
430
path : FileSystemPath ,
431
- file_size_mb : usize ,
431
+ file_size : usize ,
432
432
file_size_limit_mb : usize ,
433
433
}
434
434
@@ -458,11 +458,11 @@ impl Issue for StaticMetadataFileSizeIssue {
458
458
Ok ( Vc :: cell ( Some (
459
459
StyledString :: Text (
460
460
format ! (
461
- "File size for {} image {} exceeds {}MB. (Current: {}MB)" ,
461
+ "File size for {} image \" {} \" exceeds {}MB. (Current: {:.1 }MB)" ,
462
462
self . img_name,
463
463
self . path. value_to_string( ) . await ?,
464
464
self . file_size_limit_mb,
465
- self . file_size_mb ,
465
+ ( self . file_size as f32 ) / 1024.0 / 1024.0
466
466
)
467
467
. into ( ) ,
468
468
)
0 commit comments