Skip to content

Commit

Permalink
Use case-insensitive path predicate for test.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkocher committed Dec 13, 2024
1 parent 49e896e commit 0344b3f
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions core/src/main/java/ch/cyberduck/core/features/Move.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,18 @@
* GNU General Public License for more details.
*/

import ch.cyberduck.core.CaseInsensitivePathPredicate;
import ch.cyberduck.core.ConnectionCallback;
import ch.cyberduck.core.LocaleFactory;
import ch.cyberduck.core.Path;
import ch.cyberduck.core.Protocol;
import ch.cyberduck.core.Session;
import ch.cyberduck.core.SimplePathPredicate;
import ch.cyberduck.core.exception.AccessDeniedException;
import ch.cyberduck.core.exception.BackgroundException;
import ch.cyberduck.core.exception.InvalidFilenameException;
import ch.cyberduck.core.exception.UnsupportedException;
import ch.cyberduck.core.transfer.TransferStatus;

import org.apache.commons.lang3.StringUtils;

import java.text.MessageFormat;
import java.util.EnumSet;

Expand Down Expand Up @@ -94,10 +92,8 @@ default void preflight(final Path source, final Path target) throws BackgroundEx
static void validate(final Protocol.Case sensitivity, final Path source, final Path target) throws BackgroundException {
switch(sensitivity) {
case insensitive:
if(new SimplePathPredicate(source.getParent()).test(target.getParent())) {
if(StringUtils.equalsIgnoreCase(source.getName(), target.getName())) {
throw new UnsupportedException(MessageFormat.format(LocaleFactory.localizedString("Cannot rename {0}", "Error"), source.getName())).withFile(source);
}
if(new CaseInsensitivePathPredicate(source.getParent()).test(target.getParent())) {
throw new UnsupportedException(MessageFormat.format(LocaleFactory.localizedString("Cannot rename {0}", "Error"), source.getName())).withFile(source);
}
}
}
Expand Down

0 comments on commit 0344b3f

Please sign in to comment.