Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #16607. #16609

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,9 @@ public VersioningMode getVersioningMode() {
public Scheme getScheme() {
return Scheme.https;
}

@Override
public Case getCaseSensitivity() {
return Case.insensitive;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.Path;
import ch.cyberduck.core.PathAttributes;
import ch.cyberduck.core.SimplePathPredicate;
import ch.cyberduck.core.exception.AccessDeniedException;
import ch.cyberduck.core.exception.ConflictException;
import ch.cyberduck.core.exception.InvalidFilenameException;
Expand All @@ -35,6 +36,7 @@
import ch.cyberduck.core.transfer.TransferStatus;
import ch.cyberduck.test.IntegrationTest;

import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
import org.junit.experimental.categories.Category;

Expand Down Expand Up @@ -113,6 +115,26 @@ public void testMoveToExistingFile() throws Exception {
new DropboxDeleteFeature(session).delete(Collections.singletonList(folder), new DisabledLoginCallback(), new Delete.DisabledCallback());
}

@Test
public void testMoveCaseSensitive() throws Exception {
final Path home = new DefaultHomeFinderService(session).find();
final Path folder = new DropboxDirectoryFeature(session).mkdir(
new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus());
assertTrue(new DefaultFindFeature(session).find(folder));
final Path test = new DropboxTouchFeature(session).touch(
new Path(folder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
assertTrue(new DefaultFindFeature(session).find(test));
final Path temp = new DropboxTouchFeature(session).touch(
new Path(folder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
assertTrue(new DefaultFindFeature(session).find(temp));
new DropboxMoveFeature(session).move(temp, new Path(folder, StringUtils.upperCase(test.getName()), EnumSet.of(Path.Type.file)), new TransferStatus().exists(true), new Delete.DisabledCallback(), new DisabledConnectionCallback());
final AttributedList<Path> list = new DropboxListService(session).list(folder, new DisabledListProgressListener());
assertNotNull(list.find(new SimplePathPredicate(new Path(folder, StringUtils.upperCase(test.getName()), EnumSet.of(Path.Type.file)))));
assertNull(list.find(new SimplePathPredicate(test)));
assertTrue(new DropboxFindFeature(session).find(test));
new DropboxDeleteFeature(session).delete(Collections.singletonList(folder), new DisabledLoginCallback(), new Delete.DisabledCallback());
}

@Test
public void testMoveInvalidFilename() throws Exception {
final DropboxMoveFeature feature = new DropboxMoveFeature(session);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,32 @@

import ch.cyberduck.core.AbstractDropboxTest;
import ch.cyberduck.core.AlphanumericRandomStringService;
import ch.cyberduck.core.AttributedList;
import ch.cyberduck.core.DisabledConnectionCallback;
import ch.cyberduck.core.DisabledListProgressListener;
import ch.cyberduck.core.DisabledLoginCallback;
import ch.cyberduck.core.DisabledPasswordCallback;
import ch.cyberduck.core.Path;
import ch.cyberduck.core.SimplePathPredicate;
import ch.cyberduck.core.exception.AccessDeniedException;
import ch.cyberduck.core.features.Delete;
import ch.cyberduck.core.io.StatusOutputStream;
import ch.cyberduck.core.shared.DefaultFindFeature;
import ch.cyberduck.core.shared.DefaultHomeFinderService;
import ch.cyberduck.core.transfer.TransferStatus;
import ch.cyberduck.test.IntegrationTest;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import java.io.ByteArrayInputStream;
import java.util.Collections;
import java.util.EnumSet;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;

@Category(IntegrationTest.class)
public class DropboxTouchFeatureTest extends AbstractDropboxTest {
Expand All @@ -54,4 +63,28 @@ public void testFindFile() throws Exception {
assertTrue(new DefaultFindFeature(session).find(file));
new DropboxDeleteFeature(session).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback());
}

@Test
public void testCaseSensitivity() throws Exception {
final Path container = new DefaultHomeFinderService(session).find();
final String filename = StringUtils.lowerCase(new AlphanumericRandomStringService().random());
final Path file = new DropboxTouchFeature(session)
.touch(new Path(container, filename, EnumSet.of(Path.Type.file)), new TransferStatus().withLength(0L));
new DropboxTouchFeature(session)
.touch(new Path(container, StringUtils.upperCase(filename), EnumSet.of(Path.Type.file)), new TransferStatus().withLength(0L));
final byte[] content = RandomUtils.nextBytes(254);
final TransferStatus status = new TransferStatus();
status.setLength(content.length);
final StatusOutputStream out = new DropboxWriteFeature(session).write(
new Path(container, StringUtils.upperCase(filename), EnumSet.of(Path.Type.file)), status, new DisabledConnectionCallback());
final ByteArrayInputStream in = new ByteArrayInputStream(content);
assertEquals(content.length, IOUtils.copyLarge(in, out));
in.close();
out.close();
final AttributedList<Path> list = new DropboxListService(session).list(container, new DisabledListProgressListener());
assertNotNull(list.find(new SimplePathPredicate(new Path(container, StringUtils.upperCase(filename), EnumSet.of(Path.Type.file)))));
assertEquals(content.length, list.find(new SimplePathPredicate(new Path(container, StringUtils.upperCase(filename), EnumSet.of(Path.Type.file)))).attributes().getSize());
assertNull(list.find(new SimplePathPredicate(file)));
new DropboxDeleteFeature(session).delete(Collections.singletonList(file), new DisabledPasswordCallback(), new Delete.DisabledCallback());
}
}
Loading