File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -259,16 +259,28 @@ impl KVStore for FilesystemStore {
259
259
let entry = entry?;
260
260
let p = entry. path ( ) ;
261
261
262
- if !p. is_file ( ) {
263
- continue ;
264
- }
265
-
266
262
if let Some ( ext) = p. extension ( ) {
267
263
if ext == "tmp" {
268
264
continue ;
269
265
}
270
266
}
271
267
268
+ let metadata = p. metadata ( ) ?;
269
+
270
+ // We allow the presence of directories in the empty namespace and just skip them.
271
+ if metadata. is_dir ( ) && namespace == "" {
272
+ continue ;
273
+ }
274
+
275
+ // If we otherwise don't find a file at the given path something went wrong.
276
+ if !metadata. is_file ( ) {
277
+ debug_assert ! ( false , "Failed to list keys of namespace {}: file is not present." ,
278
+ PrintableString ( namespace) ) ;
279
+ let msg = format ! ( "Failed to list keys of namespace {}: file is not present." ,
280
+ PrintableString ( namespace) ) ;
281
+ return Err ( std:: io:: Error :: new ( std:: io:: ErrorKind :: Other , msg) ) ;
282
+ }
283
+
272
284
if let Some ( relative_path) = p. strip_prefix ( & prefixed_dest) . ok ( )
273
285
. and_then ( |p| p. to_str ( ) ) {
274
286
if relative_path. chars ( ) . all ( |c| c. is_ascii ( ) && !c. is_control ( ) ) {
You can’t perform that action at this time.
0 commit comments