-
-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'bugfix/MD-18905-bucketinhostname'
- Loading branch information
Showing
5 changed files
with
44 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
* Bug fixes, suggestions and comments should be sent to [email protected] | ||
*/ | ||
|
||
import ch.cyberduck.core.AlphanumericRandomStringService; | ||
import ch.cyberduck.core.DisabledConnectionCallback; | ||
import ch.cyberduck.core.DisabledLoginCallback; | ||
import ch.cyberduck.core.Path; | ||
|
@@ -66,6 +67,28 @@ public void testCopy() throws Exception { | |
new S3DefaultDeleteFeature(session).delete(Collections.singletonList(copy), new DisabledLoginCallback(), new Delete.DisabledCallback()); | ||
} | ||
|
||
@Test | ||
public void testCopyBucketNameInHostname() throws Exception { | ||
final Path test = new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); | ||
final byte[] content = RandomUtils.nextBytes(1023); | ||
final TransferStatus status = new TransferStatus().withLength(content.length); | ||
status.setChecksum(new SHA256ChecksumCompute().compute(new ByteArrayInputStream(content), status)); | ||
final OutputStream out = new S3WriteFeature(virtualhost, new S3AccessControlListFeature(virtualhost)).write(test, status, new DisabledConnectionCallback()); | ||
assertNotNull(out); | ||
new StreamCopier(new TransferStatus(), new TransferStatus()).transfer(new ByteArrayInputStream(content), out); | ||
out.close(); | ||
test.attributes().setSize(content.length); | ||
final Path copy = new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); | ||
final S3MultipartCopyFeature feature = new S3MultipartCopyFeature(virtualhost, new S3AccessControlListFeature(virtualhost)); | ||
feature.copy(test, copy, status, new DisabledConnectionCallback(), new DisabledStreamListener()); | ||
assertTrue(new S3FindFeature(virtualhost, new S3AccessControlListFeature(virtualhost)).find(test)); | ||
assertEquals(content.length, new S3AttributesFinderFeature(virtualhost, new S3AccessControlListFeature(virtualhost)).find(test).getSize()); | ||
new S3DefaultDeleteFeature(virtualhost).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); | ||
assertTrue(new S3FindFeature(virtualhost, new S3AccessControlListFeature(virtualhost)).find(copy)); | ||
assertEquals(content.length, new S3AttributesFinderFeature(virtualhost, new S3AccessControlListFeature(virtualhost)).find(copy).getSize()); | ||
new S3DefaultDeleteFeature(virtualhost).delete(Collections.singletonList(copy), new DisabledLoginCallback(), new Delete.DisabledCallback()); | ||
} | ||
|
||
@Test | ||
public void testCopyAWS4Signature() throws Exception { | ||
final Path container = new Path("test-eu-central-1-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume)); | ||
|