Copilot commented on code in PR #2820:
URL: https://github.com/apache/tika/pull/2820#discussion_r3251948384


##########
tika-pipes/tika-pipes-core/src/main/java/org/apache/tika/pipes/core/server/PipesWorker.java:
##########
@@ -569,22 +486,21 @@ protected ParseDataOrPipesResult parseFromTuple() throws 
TikaException, Interrup
         }
         // Use newMetadata() to apply any configured write limits
         Metadata metadata = localContext.newMetadata();
+        // Carry the caller-supplied resource name across the fresh-metadata 
boundary so
+        // detection, suffix selection, and the Frictionless manifest's name 
field see
+        // the logical filename rather than whatever the fetcher's path 
happens to be
+        // (e.g., a server-side spool prefix). TikaInputStream.get(path, 
metadata)
+        // already honors a pre-set RESOURCE_NAME_KEY.
+        String suppliedName = 
fetchEmitTuple.getMetadata().get(TikaCoreProperties.RESOURCE_NAME_KEY);

Review Comment:
   `fetchEmitTuple.getMetadata()` can be null (e.g., 
`PipesIterator.COMPLETED_SEMAPHORE` is constructed with null metadata), so 
`fetchEmitTuple.getMetadata().get(TikaCoreProperties.RESOURCE_NAME_KEY)` can 
throw an NPE. Please null-check the tuple metadata before reading from it (or 
treat a null Metadata as empty) when copying `RESOURCE_NAME_KEY` into the new 
`metadata` instance.
   



-- 
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