nandorsoma commented on a change in pull request #5475:
URL: https://github.com/apache/nifi/pull/5475#discussion_r735750015



##########
File path: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java
##########
@@ -1269,4 +1291,17 @@ private Charset getCharsetFromMediaType(MediaType 
contentType) {
     private static File getETagCacheDir() throws IOException {
         return 
Files.createTempDirectory(InvokeHTTP.class.getSimpleName()).toFile();
     }
+
+    private String getFileNameFromUrl(URL url) {
+        String fileName;
+        String path = StringUtils.removeEnd(url.getPath(), "/");
+

Review comment:
       I think you wanted to say "you should not need to use manual parsing". 
Am I right?
   About FilenameUtils. At start I wanted to use it, too, because I don't like 
custom solutions. Though it didn't work out for me. The problem is that in file 
paths trailing "/" means that it's a directory. So in a situation where path is 
ending with a "/", FilenameUtils.getName will return empty string. While for 
web URLs the situation is different, example and example/ practically mean the 
same. Not directly, but 
https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.4 mentions that.
   
   So I ended up in a situation where I think this line is unavoidable and line 
1302 can be swapped with the method you are proposing. But from the above it 
seems like FilenameUtils is not working as expected for web URLs, so I decided 
to write that line manually because it would be misleading otherwise. What do 
you think, does it make sense like that?




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