Skip to content

Commit

Permalink
- Improve parse_version_id docs
Browse files Browse the repository at this point in the history
- Revert `s3_rest.js` changes

Signed-off-by: Ben <belimele@redhat.com>
  • Loading branch information
Neon-White committed May 7, 2024
1 parent 15a63b3 commit 2e993d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/endpoint/s3/s3_rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const s3_ops = require('./ops');
const S3Error = require('./s3_errors').S3Error;
const s3_bucket_policy_utils = require('./s3_bucket_policy_utils');
const s3_logging = require('./s3_bucket_logging');
const s3_utils = require('./s3_utils');
const time_utils = require('../../util/time_utils');
const http_utils = require('../../util/http_utils');
const signature_utils = require('../../util/signature_utils');
Expand Down Expand Up @@ -119,7 +118,9 @@ async function handle_request(req, res) {
usage_report.s3_usage_info.total_calls += 1;
usage_report.s3_usage_info[op_name] = (usage_report.s3_usage_info[op_name] || 0) + 1;

if (s3_utils.parse_version_id(req.query?.versionId)) {


if (req.query && req.query.versionId) {
const caching = await req.object_sdk.read_bucket_sdk_caching_info(req.params.bucket);
if (caching) {
dbg.error('S3 Version request not (NotImplemented) for buckets with caching', op_name, req.method, req.originalUrl);
Expand Down Expand Up @@ -265,7 +266,7 @@ function _get_method_from_req(req) {
dbg.error(`Got a not supported S3 op ${req.op_name} - doesn't suppose to happen`);
throw new S3Error(S3Error.InternalError);
}
if (s3_utils.parse_version_id(req.query?.versionId) && s3_op.versioned) {
if (req.query && req.query.versionId && s3_op.versioned) {
return s3_op.versioned;
}
return s3_op.regular;
Expand Down
2 changes: 1 addition & 1 deletion src/endpoint/s3/s3_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ function encode_uri_unless_already_encoded(uri = '') {

/**
* parse_version_id throws an error if version_id is an empty string, and returns it otherwise
* @param {string} version_id
* @param {string|undefined} version_id
*/
function parse_version_id(version_id) {
if (version_id === '') {
Expand Down

0 comments on commit 2e993d4

Please sign in to comment.