@@ -34,7 +34,7 @@ function getVeeamFile(request, response, bucketMd, log) {
3434
3535 // Extract the last modified date, but do not include it when computing
3636 // the file's ETag (md5)
37- const modified = fileToBuild . value . LastModified ;
37+ const modified = bucketMetrics ?. date || fileToBuild . value . LastModified ;
3838 delete fileToBuild . value . LastModified ;
3939
4040 // The SOSAPI metrics are dynamically computed using the SUR backend.
@@ -53,15 +53,14 @@ function getVeeamFile(request, response, bucketMd, log) {
5353 return respondWithData ( request , response , log , data ,
5454 buildHeadXML ( builder . buildObject ( fileToBuild . value ) ) , modified ) ;
5555 } ;
56+
5657 if ( ! isSystemXML ( request . objectKey ) ) {
5758 const bucketKey = `${ bucketMd . _name } _${ new Date ( bucketMd . _creationDate ) . getTime ( ) } ` ;
5859 return UtilizationService . getUtilizationMetrics ( 'bucket' , bucketKey , null , { } , ( err , bucketMetrics ) => {
5960 if ( err ) {
60- // Handle errors from UtilizationService/scubaclient
61- // axios errors have status in err.response.status
6261 const statusCode = err . response ?. status || err . statusCode || err . code ;
62+
6363 // Only handle 404 gracefully (no metrics available yet, e.g. post-install)
64- // For 404, continue with static capacity data (Used=0 from bucket metadata)
6564 if ( statusCode === 404 ) {
6665 log . warn ( 'UtilizationService returned 404 when fetching capacity metrics' , {
6766 method : 'getVeeamFile' ,
@@ -70,14 +69,17 @@ function getVeeamFile(request, response, bucketMd, log) {
7069 } ) ;
7170 return finalizeRequest ( ) ;
7271 }
72+
7373 log . error ( 'error fetching capacity metrics from UtilizationService' , {
7474 method : 'getVeeamFile' ,
7575 bucket : request . bucketName ,
7676 error : err . message || err . code ,
7777 statusCode,
7878 } ) ;
79+
7980 return responseXMLBody ( errors . InternalError , null , response , log ) ;
8081 }
82+
8183 return finalizeRequest ( bucketMetrics ) ;
8284 } ) ;
8385 }
0 commit comments