@@ -301,9 +301,9 @@ function filter_fs_xattr(xattr) {
301
301
302
302
/**
303
303
* get_random_delay returns a random delay number between base + min and max
304
- * @param {number } base
305
- * @param {number } min
306
- * @param {number } max
304
+ * @param {number } base
305
+ * @param {number } min
306
+ * @param {number } max
307
307
* @returns {number }
308
308
*/
309
309
function get_random_delay ( base , min , max ) {
@@ -1022,7 +1022,11 @@ class NamespaceFS {
1022
1022
// NOTE: don't move this code after the open
1023
1023
// this can lead to ENOENT failures due to file not exists when content size is 0
1024
1024
// if entry is a directory object and its content size = 0 - return empty response
1025
- if ( await this . _is_empty_directory_content ( file_path , fs_context , params ) ) return null ;
1025
+ if ( await this . _is_empty_directory_content ( file_path , fs_context , params ) ) {
1026
+ res . end ( ) ;
1027
+ await stream_utils . wait_finished ( res , { signal : object_sdk . abort_controller . signal } ) ;
1028
+ return null ;
1029
+ }
1026
1030
1027
1031
file = await nb_native ( ) . fs . open (
1028
1032
fs_context ,
@@ -1312,14 +1316,14 @@ class NamespaceFS {
1312
1316
1313
1317
/**
1314
1318
* _check_copy_storage_class returns true if a copy is needed to be forced.
1315
- *
1319
+ *
1316
1320
* This might be needed if we need to manage xattr separately on the source
1317
1321
* object and target object (eg. GLACIER objects).
1318
- *
1322
+ *
1319
1323
* NOTE: The function will throw S3 error if source object storage class is
1320
1324
* "GLACIER" but it is not in restored state (AWS behaviour).
1321
- * @param {nb.NativeFSContext } fs_context
1322
- * @param {Record<any, any> } params
1325
+ * @param {nb.NativeFSContext } fs_context
1326
+ * @param {Record<any, any> } params
1323
1327
* @returns {Promise<boolean> }
1324
1328
*/
1325
1329
async _check_copy_storage_class ( fs_context , params ) {
@@ -1472,7 +1476,7 @@ class NamespaceFS {
1472
1476
1473
1477
// 1. get latest version_id
1474
1478
// 2. if versioning is suspended -
1475
- // 2.1 if version ID of the latest version is null -
1479
+ // 2.1 if version ID of the latest version is null -
1476
1480
// 2.1.1. if it's POSIX backend - unlink the null version
1477
1481
// 2.1.2. if it's GPFS backend - nothing to do, the linkatif will override it
1478
1482
// 2.2 else (version ID of the latest version is unique or there is no latest version) -
@@ -1683,7 +1687,7 @@ class NamespaceFS {
1683
1687
const delimiter_idx = create_params_parsed . key . indexOf ( params . delimiter , start_idx ) ;
1684
1688
if ( delimiter_idx > 0 ) {
1685
1689
common_prefixes_set . add ( create_params_parsed . key . substring ( 0 , delimiter_idx + 1 ) ) ;
1686
- // if key has common prefix it should not be returned as an upload object
1690
+ // if key has common prefix it should not be returned as an upload object
1687
1691
return undefined ;
1688
1692
}
1689
1693
}
@@ -1732,7 +1736,7 @@ class NamespaceFS {
1732
1736
return path . join ( params . mpu_path , `part-${ params . num } ` ) ;
1733
1737
}
1734
1738
1735
- // optimized version of upload_multipart -
1739
+ // optimized version of upload_multipart -
1736
1740
// 1. if size is pre known -
1737
1741
// 1.1. calc offset
1738
1742
// 1.2. upload data to by_size file in offset position
@@ -2209,12 +2213,12 @@ class NamespaceFS {
2209
2213
/**
2210
2214
* restore_object simply sets the restore request xattr
2211
2215
* which should be picked by another mechanism.
2212
- *
2216
+ *
2213
2217
* restore_object internally relies on 2 xattrs:
2214
2218
* - XATTR_RESTORE_REQUEST
2215
2219
* - XATTR_RESTORE_EXPIRY
2216
- * @param {* } params
2217
- * @param {nb.ObjectSDK } object_sdk
2220
+ * @param {* } params
2221
+ * @param {nb.ObjectSDK } object_sdk
2218
2222
* @returns {Promise<Object> }
2219
2223
*/
2220
2224
async restore_object ( params , object_sdk ) {
@@ -2352,7 +2356,7 @@ class NamespaceFS {
2352
2356
}
2353
2357
2354
2358
/**
2355
- *
2359
+ *
2356
2360
* @param {* } fs_context - fs context object
2357
2361
* @param {string } file_path - path to file
2358
2362
* @param {* } set - the xattr object to be set
@@ -2706,7 +2710,7 @@ class NamespaceFS {
2706
2710
}
2707
2711
try {
2708
2712
// Returns the real path of the entry.
2709
- // The entry path may point to regular file or directory, but can have symbolic links
2713
+ // The entry path may point to regular file or directory, but can have symbolic links
2710
2714
const full_path = await nb_native ( ) . fs . realpath ( fs_context , entry_path ) ;
2711
2715
if ( ! full_path . startsWith ( this . bucket_path ) ) {
2712
2716
dbg . log0 ( 'check_bucket_boundaries: the path' , entry_path , 'is not in the bucket' , this . bucket_path , 'boundaries' ) ;
@@ -3380,9 +3384,9 @@ class NamespaceFS {
3380
3384
/**
3381
3385
* _check_version_moved recieves key and version_id and checks if the version still exists in one of the optional locations
3382
3386
* latest version location or .versions/ directory
3383
- * @param {import('./nb').NativeFSContext } fs_context
3384
- * @param {string } key
3385
- * @param {string } version_id
3387
+ * @param {import('./nb').NativeFSContext } fs_context
3388
+ * @param {string } key
3389
+ * @param {string } version_id
3386
3390
*/
3387
3391
async _check_version_moved ( fs_context , key , version_id ) {
3388
3392
const latest_version_path = this . _get_file_path ( { key } ) ;
0 commit comments