Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-7602

isCopyOnItself check returns invalid result when moving directory

    XMLWordPrintableJSON

Details

    Description

      When using moveTo to move a directory the isCopyOnItself check fails if the directory name starts the same but is different. Example:

      Source:
      /storage/emulated/0/GalileoMobile
      Destination:
      /storage/emulated/0/GalileoMobileBackup/GalileoMobile

      The issue is with the indexof check looking for any slash following the partial match.

      Existing Line 305 of LocalFileSystem.java:
      if (dest.startsWith(src) && dest.indexOf(File.separator, src.length() - 1) != -1) {

      Something like this should work:
      if (dest.equals(src) || dest.startsWith(src + File.separator) ) {

      This would also occur with copies.

      Attachments

        Activity

          People

            iclelland Ian Clelland
            thgood Tom Good
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: