@@ -2200,8 +2200,9 @@ void RGWGetObj::execute(optional_yield y)
22002200 gc_invalidate_time = ceph_clock_now ();
22012201 gc_invalidate_time += (s->cct ->_conf ->rgw_gc_obj_min_wait / 2 );
22022202
2203- bool need_decompress;
2204- int64_t ofs_x, end_x;
2203+ bool need_decompress = false ;
2204+ int64_t ofs_x = 0 , end_x = 0 ;
2205+ bool encrypted = false ;
22052206
22062207 RGWGetObj_CB cb (this );
22072208 RGWGetObj_Filter* filter = (RGWGetObj_Filter *)&cb;
@@ -2301,11 +2302,17 @@ void RGWGetObj::execute(optional_yield y)
23012302 ldpp_dout (this , 0 ) << " ERROR: failed to decode compression info, cannot decompress" << dendl;
23022303 goto done_err;
23032304 }
2304- if (need_decompress) {
2305- s->obj_size = cs_info.orig_size ;
2306- s->object ->set_obj_size (cs_info.orig_size );
2307- decompress.emplace (s->cct , &cs_info, partial_content, filter);
2308- filter = &*decompress;
2305+
2306+ // where encryption and compression are combined, compression was applied to
2307+ // the data before encryption. if the system header rgwx-skip-decrypt is
2308+ // present, we have to skip the decompression filter too
2309+ encrypted = attrs.count (RGW_ATTR_CRYPT_MODE);
2310+
2311+ if (need_decompress && (!encrypted || !skip_decrypt)) {
2312+ s->obj_size = cs_info.orig_size ;
2313+ s->object ->set_obj_size (cs_info.orig_size );
2314+ decompress.emplace (s->cct , &cs_info, partial_content, filter);
2315+ filter = &*decompress;
23092316 }
23102317
23112318 attr_iter = attrs.find (RGW_ATTR_OBJ_REPLICATION_TRACE);
0 commit comments