sunithabeeram commented on a change in pull request #3671:  Make different 
PinotFS concrete classes have the same behaviors
URL: https://github.com/apache/incubator-pinot/pull/3671#discussion_r246893705
 
 

 ##########
 File path: 
pinot-filesystem/src/main/java/com/linkedin/pinot/filesystem/LocalPinotFS.java
 ##########
 @@ -97,7 +97,8 @@ public boolean move(URI srcUri, URI dstUri, boolean 
overwrite) throws IOExceptio
   public boolean copy(URI srcUri, URI dstUri) throws IOException {
     File srcFile = new File(decodeURI(srcUri.getRawPath()));
     File dstFile = new File(decodeURI(dstUri.getRawPath()));
-    if (dstFile.exists()) {
+    // delete dst only if dst isn't under src.
+    if (!dstFile.getCanonicalPath().startsWith(srcFile.getCanonicalPath()) && 
dstFile.exists()) {
 
 Review comment:
   I don't think previous dst/name1 should be deleted. Will be good to review 
this and see if we should honor this contract:
   If name1 is a folder and dst/name1 is a file, operation should fail.
   If name1 is a folder and dst/name1 is a folder, src folder will get copied 
under dst/name1.
   If name1 is a file and dst/name1 is a file, dst/name1 will get overwritten.
   If name1 is a file and dst/name1 is a folder, src file will get copied under 
dst/name1.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to