File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed
libsql-wal/src/bottomless/storage Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -286,6 +286,8 @@ pub enum LoadDumpError {
286
286
NoTxn ,
287
287
#[ error( "The dump should commit the transaction." ) ]
288
288
NoCommit ,
289
+ #[ error( "Path is not a file" ) ]
290
+ NotAFile ,
289
291
}
290
292
291
293
impl ResponseError for LoadDumpError { }
@@ -303,6 +305,7 @@ impl IntoResponse for &LoadDumpError {
303
305
| UnsupportedUrlScheme ( _)
304
306
| NoTxn
305
307
| NoCommit
308
+ | NotAFile
306
309
| DumpFilePathNotAbsolute => self . format_err ( StatusCode :: BAD_REQUEST ) ,
307
310
}
308
311
}
Original file line number Diff line number Diff line change @@ -408,6 +408,10 @@ where
408
408
return Err ( LoadDumpError :: DumpFileDoesntExist ) ;
409
409
}
410
410
411
+ if !path. is_file ( ) {
412
+ return Err ( LoadDumpError :: NotAFile ) ;
413
+ }
414
+
411
415
let f = tokio:: fs:: File :: open ( path) . await ?;
412
416
413
417
Ok ( Box :: new ( ReaderStream :: new ( f) ) )
Original file line number Diff line number Diff line change @@ -45,9 +45,9 @@ impl<I: Io> Storage for FsStorage<I> {
45
45
46
46
let path = self . prefix . join ( "segments" ) . join ( key) ;
47
47
48
- let buf = Vec :: with_capacity ( dbg ! ( segment_data. len( ) . unwrap( ) ) as usize ) ;
48
+ let buf = Vec :: with_capacity ( segment_data. len ( ) . unwrap ( ) as usize ) ;
49
49
50
- let f = self . io . open ( true , false , true , dbg ! ( & path) ) . unwrap ( ) ;
50
+ let f = self . io . open ( true , false , true , & path) . unwrap ( ) ;
51
51
async move {
52
52
let ( buf, res) = segment_data. read_exact_at_async ( buf, 0 ) . await ;
53
53
@@ -88,10 +88,7 @@ impl<I: Io> Storage for FsStorage<I> {
88
88
use crate :: io:: buf:: ZeroCopyBuf ;
89
89
90
90
let header_buf = ZeroCopyBuf :: < CompactedSegmentDataHeader > :: new_uninit ( ) ;
91
- let file = self
92
- . io
93
- . open ( false , true , false , dbg ! ( & entry. path( ) ) )
94
- . unwrap ( ) ;
91
+ let file = self . io . open ( false , true , false , & entry. path ( ) ) . unwrap ( ) ;
95
92
let ( header_buf, res) = file. read_exact_at_async ( header_buf, 0 ) . await ;
96
93
res. unwrap ( ) ;
97
94
You can’t perform that action at this time.
0 commit comments