api: field_handler: Ignore empty ResultPath fields

If we add a ResultPath to a message but don't immediately start filling
it, extract_results() will still generate an empty destination path and
use it, generating response messages that the (unchanged) client won't
understand.

Only use the destination path if it's non-empty.

BUG=b:289353958
TEST=./run_tests

Change-Id: Ic3319ff8667d98074d7d37cd511d1c827d5419bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4655747
Commit-Queue: Brian Norris <briannorris@chromium.org>
Reviewed-by: Sergey Frolov <sfrolov@google.com>
Tested-by: Brian Norris <briannorris@chromium.org>
diff --git a/api/field_handler.py b/api/field_handler.py
index 80a1da5..0ff3bd4 100644
--- a/api/field_handler.py
+++ b/api/field_handler.py
@@ -353,6 +353,10 @@
         return
 
     destination = result_path_message.path.path
+    # ResultPath wasn't filled; don't copy to undefined location.
+    if not destination:
+        return
+
     handlers = _extract_handlers(
         response_message, destination, chroot=chroot, delete=False, reset=False
     )