bneradt commented on code in PR #13390:
URL: https://github.com/apache/trafficserver/pull/13390#discussion_r3590793011


##########
plugins/webp_transform/ImageTransform.cc:
##########
@@ -105,8 +125,20 @@ class ImageTransform : public TransformationPlugin
   handleInputComplete() override
   {
     std::string input_data = _img.str();
-    Blob        input_blob(input_data.data(), input_data.length());
-    Image       image;
+
+    if (!has_signature_for(input_data, _input_image_type)) {
+      TSError("[webp_transform] input body does not match its declared image 
encoding: %d, length: %zu",
+              static_cast<int>(_input_image_type), input_data.length());
+      if (!input_data.empty()) {
+        produce(input_data);
+      }
+      _transform_image_type = _input_image_type;
+      setOutputComplete();
+      return;

Review Comment:
   Done. Content-Type is now selected in the send-response-header hook after 
the transform result is known, preserving the original value when conversion is 
bypassed.



##########
plugins/webp_transform/ImageTransform.cc:
##########
@@ -105,8 +125,20 @@ class ImageTransform : public TransformationPlugin
   handleInputComplete() override
   {
     std::string input_data = _img.str();
-    Blob        input_blob(input_data.data(), input_data.length());
-    Image       image;
+
+    if (!has_signature_for(input_data, _input_image_type)) {
+      TSError("[webp_transform] input body does not match its declared image 
encoding: %d, length: %zu",
+              static_cast<int>(_input_image_type), input_data.length());
+      if (!input_data.empty()) {
+        produce(input_data);
+      }
+      _transform_image_type = _input_image_type;
+      setOutputComplete();

Review Comment:
   Done. Content-Type is now selected in the send-response-header hook after 
the transform result is known, preserving the original value when conversion is 
bypassed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to