From 07f53e5795c77df287e3bb9f35598028a83645d2 Mon Sep 17 00:00:00 2001 From: David Kocher Date: Thu, 20 Nov 2025 17:20:29 +0100 Subject: [PATCH 1/7] Generalize checksum validation for uploads by comparing with attributes from server. --- .../core/azure/AzureUploadFeature.java | 1 - .../core/b2/B2LargeUploadService.java | 17 +-- .../core/b2/B2SingleUploadService.java | 46 +------- .../core/b2/B2ThresholdUploadService.java | 8 +- .../core/b2/B2LargeUploadServiceTest.java | 19 +-- .../cyberduck/core/b2/B2ReadFeatureTest.java | 9 +- .../core/b2/B2SingleUploadServiceTest.java | 5 +- .../cryptomator/B2LargeUploadServiceTest.java | 5 +- .../B2ConcurrentTransferWorkerTest.java | 4 +- .../worker/B2SingleTransferWorkerTest.java | 4 +- .../core/box/BoxLargeUploadService.java | 15 +-- .../core/box/BoxSmallUploadService.java | 4 +- .../core/box/BoxThresholdUploadService.java | 7 +- .../core/box/BoxLargeUploadServiceTest.java | 3 +- .../BoxThresholdUploadServiceTest.java | 3 +- .../brick/BrickThresholdUploadFeature.java | 5 +- .../core/brick/BrickUploadFeature.java | 15 +-- .../core/brick/BrickWriteFeature.java | 18 --- .../core/brick/BrickCopyFeatureTest.java | 7 +- .../core/brick/BrickDeleteFeatureTest.java | 3 +- .../core/brick/BrickLockFeatureTest.java | 3 +- .../core/brick/BrickMoveFeatureTest.java | 3 +- .../core/brick/BrickReadFeatureTest.java | 5 +- .../BrickThresholdUploadFeatureTest.java | 5 +- .../core/brick/BrickUploadFeatureTest.java | 7 +- .../cyberduck/core/worker/CopyWorkerTest.java | 7 +- .../main/java/ch/cyberduck/core/Session.java | 2 +- .../ch/cyberduck/core/features/Upload.java | 4 +- .../core/http/HttpUploadFeature.java | 109 +----------------- .../core/shared/DefaultUploadFeature.java | 66 ++++++++--- .../core/transfer/UploadTransfer.java | 2 +- .../transfer/upload/AbstractUploadFilter.java | 18 +++ .../registry/VaultRegistryUploadFeature.java | 6 +- .../ch/cyberduck/core/NullUploadFeature.java | 3 +- .../transfer/upload/ResumeFilterTest.java | 2 +- .../features/CryptoUploadFeature.java | 5 +- .../CteraConcurrentTransferWorkerTest.java | 5 +- .../ctera/CteraDirectIOReadFeatureTest.java | 5 +- .../core/ctera/CteraReadFeatureTest.java | 13 ++- .../core/ctera/CteraWriteFeatureTest.java | 11 +- .../src/main/resources/default.properties | 1 - .../core/sds/SDSDirectS3UploadFeature.java | 17 +-- .../ch/cyberduck/core/sds/SDSSession.java | 2 +- .../cyberduck/core/sds/SDSUploadService.java | 16 +-- .../core/sds/SDSDeleteFeatureTest.java | 3 +- .../sds/SDSDirectS3UploadFeatureTest.java | 19 +-- .../core/sds/SDSReadFeatureTest.java | 9 +- .../core/dropbox/DropboxSession.java | 2 +- .../core/dropbox/DropboxUploadFeature.java | 49 +------- .../core/dropbox/DropboxWriteFeature.java | 2 + .../core/dropbox/DropboxReadFeatureTest.java | 5 +- .../dropbox/DropboxUploadFeatureTest.java | 14 ++- .../core/eue/EueLargeUploadService.java | 12 +- .../core/eue/EueSingleUploadService.java | 8 +- .../core/eue/EueThresholdUploadService.java | 9 +- .../cyberduck/core/eue/EueUploadService.java | 8 +- .../EueSingleUploadServiceTest.java | 3 +- .../EueThresholdUploadServiceTest.java | 5 +- .../cryptomator/EueUploadServiceTest.java | 9 +- .../core/eue/EueCopyFeatureTest.java | 3 +- .../core/eue/EueLargeUploadServiceTest.java | 3 +- .../core/eue/EueSingleUploadServiceTest.java | 5 +- .../eue/EueThresholdUploadServiceTest.java | 5 +- .../core/eue/EueUploadServiceTest.java | 5 +- .../ch/cyberduck/core/ftp/FTPSession.java | 2 +- .../cyberduck/core/ftp/FTPUploadFeature.java | 5 - .../core/ftp/FTPUploadFeatureTest.java | 2 +- .../core/shared/DefaultUploadFeatureTest.java | 9 +- .../core/googledrive/DriveSession.java | 2 +- .../core/googledrive/DriveUploadFeature.java | 7 +- .../googledrive/DriveReadFeatureTest.java | 5 +- .../googledrive/DriveUploadFeatureTest.java | 5 +- .../DefaultUploadFeatureTest.java | 5 +- .../core/irods/IRODSUploadFeature.java | 6 +- .../core/irods/IRODSReadFeatureTest.java | 5 +- .../core/irods/IRODSUploadFeatureTest.java | 9 +- .../core/manta/MantaReadFeatureTest.java | 9 +- .../ch/cyberduck/core/nio/LocalSession.java | 2 +- .../core/nio/LocalUploadFeature.java | 5 - .../core/nio/LocalUploadFeatureTest.java | 2 +- .../core/onedrive/GraphReadFeatureTest.java | 9 +- .../SwiftLargeObjectUploadFeature.java | 15 +-- .../SwiftSmallObjectUploadFeature.java | 48 +------- .../SwiftThresholdUploadService.java | 8 +- .../SwiftLargeObjectUploadFeatureTest.java | 4 +- .../SwiftLargeObjectUploadFeatureTest.java | 17 +-- .../SwiftSmallObjectUploadFeatureTest.java | 69 ----------- .../worker/SwiftSingleTransferWorkerTest.java | 4 +- .../cryptomator/OcisUploadFeatureTest.java | 3 +- .../core/owncloud/OcisUploadFeatureTest.java | 5 +- .../core/s3/S3MultipartUploadService.java | 17 +-- .../core/s3/S3MultipartWriteFeature.java | 2 +- .../core/s3/S3SingleUploadService.java | 50 +++----- .../core/s3/S3ThresholdUploadService.java | 10 +- .../S3MultipartUploadServiceTest.java | 7 +- .../S3SingleUploadServiceTest.java | 3 +- .../core/s3/S3MultipartUploadServiceTest.java | 27 +++-- .../core/s3/S3SingleUploadServiceTest.java | 19 +-- .../core/s3/S3ThresholdUploadServiceTest.java | 9 +- .../worker/S3SingleTransferWorkerTest.java | 6 +- .../core/spectra/SpectraUploadFeature.java | 9 +- .../spectra/SpectraUploadFeatureTest.java | 7 +- .../core/sftp/SFTPUploadFeature.java | 2 +- .../core/shared/DefaultUploadFeatureTest.java | 9 +- .../storegate/StoregateReadFeatureTest.java | 9 +- .../cyberduck/core/tus/TusUploadFeature.java | 15 +-- .../ch/cyberduck/core/dav/DAVSession.java | 2 +- .../cyberduck/core/dav/DAVUploadFeature.java | 8 +- .../core/cryptomator/DAVReadFeatureTest.java | 2 +- .../core/cryptomator/DAVWriteFeatureTest.java | 2 +- .../core/dav/DAVLockFeatureTest.java | 5 +- .../core/dav/DAVReadFeatureTest.java | 13 ++- .../core/dav/DAVUploadFeatureTest.java | 15 +-- .../core/dav/DAVWriteFeatureTest.java | 19 +-- .../MicrosoftIISDAVLockFeatureTest.java | 7 +- .../MicrosoftIISDAVReadFeatureTest.java | 5 +- .../MicrosoftIISDAVUploadFeatureTest.java | 13 ++- .../DAVConcurrentTransferWorkerTest.java | 7 +- .../worker/DAVSingleTransferWorkerTest.java | 4 +- 119 files changed, 521 insertions(+), 737 deletions(-) delete mode 100644 openstack/src/test/java/ch/cyberduck/core/openstack/SwiftSmallObjectUploadFeatureTest.java diff --git a/azure/src/main/java/ch/cyberduck/core/azure/AzureUploadFeature.java b/azure/src/main/java/ch/cyberduck/core/azure/AzureUploadFeature.java index b787d8e0f3d..a653ecd8870 100644 --- a/azure/src/main/java/ch/cyberduck/core/azure/AzureUploadFeature.java +++ b/azure/src/main/java/ch/cyberduck/core/azure/AzureUploadFeature.java @@ -29,7 +29,6 @@ public class AzureUploadFeature extends DefaultUploadFeature { private final AzureSession session; public AzureUploadFeature(final AzureSession session) { - super(session); this.session = session; } diff --git a/backblaze/src/main/java/ch/cyberduck/core/b2/B2LargeUploadService.java b/backblaze/src/main/java/ch/cyberduck/core/b2/B2LargeUploadService.java index c69873f8da9..5663f1086ff 100644 --- a/backblaze/src/main/java/ch/cyberduck/core/b2/B2LargeUploadService.java +++ b/backblaze/src/main/java/ch/cyberduck/core/b2/B2LargeUploadService.java @@ -39,11 +39,12 @@ import ch.cyberduck.core.transfer.SegmentRetryCallable; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.io.IOException; -import java.security.MessageDigest; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Comparator; @@ -61,7 +62,7 @@ import static ch.cyberduck.core.b2.B2MetadataFeature.X_BZ_INFO_SRC_CREATION_DATE_MILLIS; import static ch.cyberduck.core.b2.B2MetadataFeature.X_BZ_INFO_SRC_LAST_MODIFIED_MILLIS; -public class B2LargeUploadService extends HttpUploadFeature { +public class B2LargeUploadService extends HttpUploadFeature { private static final Logger log = LogManager.getLogger(B2LargeUploadService.class); /** @@ -93,7 +94,7 @@ public B2LargeUploadService(final B2Session session, final B2VersionIdProvider f @Override public BaseB2Response upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, - final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { + final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { final long partSize; if(file.getType().contains(Path.Type.encrypted)) { // For uploads to vault part size must be a multiple of 32 * 1024. Recommended partsize from B2 API may not meet that requirement. @@ -103,12 +104,12 @@ public BaseB2Response upload(final Write write, final Path file, partSize = this.partSize; } return this.upload(write, file, local, throttle, progress, streamListener, status, callback, - partSize < status.getLength() ? partSize : PreferencesFactory.get().getLong("b2.upload.largeobject.size.minimum")); + partSize < status.getLength() ? partSize : PreferencesFactory.get().getLong("b2.upload.largeobject.size.minimum"), options); } public BaseB2Response upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, - final ConnectionCallback callback, final Long partSize) throws BackgroundException { + final ConnectionCallback callback, final Long partSize, final UploadFilterOptions options) throws BackgroundException { final ThreadPool pool = ThreadPoolFactory.get("largeupload", concurrency); try { // Get the results of the uploads in the order they were submitted @@ -170,7 +171,7 @@ public BaseB2Response upload(final Write write, final Path file, if(!skip) { final long length = Math.min(Math.max((size / B2LargeUploadService.MAXIMUM_UPLOAD_PARTS), partSize), remaining); // Submit to queue - parts.add(this.submit(pool, write, file, local, throttle, streamListener, status, fileId, partNumber, offset, length, callback)); + parts.add(this.submit(pool, write, file, local, throttle, streamListener, status, fileId, partNumber, offset, length, callback, options)); log.debug("Part {} submitted with size {} and offset {}", partNumber, length, offset); remaining -= length; offset += length; @@ -211,7 +212,7 @@ private Future submit(final ThreadPool pool, final Write { - - private final B2Session session; - - public B2SingleUploadService(final B2Session session) { - this.session = session; - } - - @Override - protected InputStream decorate(final InputStream in, final MessageDigest digest) throws IOException { - if(null == digest) { - return super.decorate(in, null); - } - else { - return new DigestInputStream(in, digest); - } - } +public class B2SingleUploadService extends HttpUploadFeature { @Override protected MessageDigest digest() throws IOException { - MessageDigest digest = null; - if(HostPreferencesFactory.get(session.getHost()).getBoolean("b2.upload.checksum.verify")) { - try { - digest = MessageDigest.getInstance("SHA1"); - } - catch(NoSuchAlgorithmException e) { - throw new IOException(e.getMessage(), e); - } + try { + return MessageDigest.getInstance("SHA1"); + } + catch(NoSuchAlgorithmException e) { + throw new IOException(e.getMessage(), e); } - return digest; - } - - @Override - protected void post(final Path file, final MessageDigest digest, final BaseB2Response response) throws BackgroundException { - this.verify(file, digest, Checksum.parse(StringUtils.removeStart(((B2FileResponse) response).getContentSha1(), "unverified:"))); } } diff --git a/backblaze/src/main/java/ch/cyberduck/core/b2/B2ThresholdUploadService.java b/backblaze/src/main/java/ch/cyberduck/core/b2/B2ThresholdUploadService.java index b7bfdcaf68f..303c6700033 100644 --- a/backblaze/src/main/java/ch/cyberduck/core/b2/B2ThresholdUploadService.java +++ b/backblaze/src/main/java/ch/cyberduck/core/b2/B2ThresholdUploadService.java @@ -27,6 +27,8 @@ import ch.cyberduck.core.preferences.HostPreferencesFactory; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -59,12 +61,12 @@ public Write.Append append(final Path file, final TransferStatus status) throws @Override public BaseB2Response upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { + final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { if(this.threshold(status)) { - return new B2LargeUploadService(session, fileid).upload(write, file, local, throttle, progress, streamListener, status, callback); + return new B2LargeUploadService(session, fileid).upload(write, file, local, throttle, progress, streamListener, status, callback, options); } else { - return new B2SingleUploadService(session).upload(write, file, local, throttle, progress, streamListener, status, callback); + return new B2SingleUploadService().upload(write, file, local, throttle, progress, streamListener, status, callback, options); } } diff --git a/backblaze/src/test/java/ch/cyberduck/core/b2/B2LargeUploadServiceTest.java b/backblaze/src/test/java/ch/cyberduck/core/b2/B2LargeUploadServiceTest.java index 1019eb0d757..7e2687a50e7 100644 --- a/backblaze/src/test/java/ch/cyberduck/core/b2/B2LargeUploadServiceTest.java +++ b/backblaze/src/test/java/ch/cyberduck/core/b2/B2LargeUploadServiceTest.java @@ -38,6 +38,7 @@ import ch.cyberduck.core.io.StreamProgress; import ch.cyberduck.core.shared.DefaultFindFeature; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -83,7 +84,7 @@ public void testUpload() throws Exception { final B2LargeUploadService upload = new B2LargeUploadService(session, fileid, 5 * 1000L * 1000L, 5); upload.upload(new B2WriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), - status, new DisabledConnectionCallback()); + status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final PathAttributes attr = new B2AttributesFinderFeature(session, fileid).find(test); assertNotEquals(Checksum.NONE, attr.getChecksum()); assertEquals(checksum, attr.getChecksum()); @@ -118,15 +119,15 @@ public void testAppendNoPartCompleted() throws Exception { final B2VersionIdProvider fileid = new B2VersionIdProvider(session); final B2LargeUploadService service = new B2LargeUploadService(session, fileid, 5 * 1000L * 1000L, 1) { @Override - public BaseB2Response upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final StreamCancelation cancel, final StreamProgress progress, final ConnectionCallback callback) throws BackgroundException { + public BaseB2Response transfer(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final StreamCancelation cancel, final StreamProgress progress, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { if(!interrupt.get()) { throw new ConnectionTimeoutException("Test"); } - return super.upload(write, file, local, throttle, listener, status, cancel, progress, callback); + return super.transfer(write, file, local, throttle, listener, status, cancel, progress, callback, options); } }; try { - service.upload(new B2WriteFeature(session, fileid), test, new Local(System.getProperty("java.io.tmpdir"), name), new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledLoginCallback()); + service.upload(new B2WriteFeature(session, fileid), test, new Local(System.getProperty("java.io.tmpdir"), name), new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); } catch(BackgroundException e) { // Expected @@ -142,7 +143,7 @@ public BaseB2Response upload(final Write write, final Path file, final TransferStatus append = new TransferStatus().setAppend(true).setLength(content.length); service.upload(new B2WriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), append, - new DisabledLoginCallback()); + new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length, append.getResponse().getSize()); assertTrue(new B2FindFeature(session, fileid).find(test)); assertEquals(content.length, new B2AttributesFinderFeature(session, fileid).find(test).getSize()); @@ -171,18 +172,18 @@ public void testAppendSecondPart() throws Exception { final B2VersionIdProvider fileid = new B2VersionIdProvider(session); final B2LargeUploadService feature = new B2LargeUploadService(session, fileid, 5 * 1000L * 1000L, 1) { @Override - public BaseB2Response upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final StreamCancelation cancel, final StreamProgress progress, final ConnectionCallback callback) throws BackgroundException { + public BaseB2Response transfer(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final StreamCancelation cancel, final StreamProgress progress, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { if(!interrupt.get()) { if(status.getOffset() >= 5L * 1000L * 1000L) { throw new ConnectionTimeoutException("Test"); } } - return super.upload(write, file, local, throttle, listener, status, cancel, progress, callback); + return super.transfer(write, file, local, throttle, listener, status, cancel, progress, callback, options); } }; final BytecountStreamListener count = new BytecountStreamListener(); try { - feature.upload(new B2WriteFeature(session, fileid), test, new Local(System.getProperty("java.io.tmpdir"), name), new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledLoginCallback()); + feature.upload(new B2WriteFeature(session, fileid), test, new Local(System.getProperty("java.io.tmpdir"), name), new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); } catch(BackgroundException e) { // Expected @@ -201,7 +202,7 @@ public BaseB2Response upload(final Write write, final Path file, final TransferStatus append = new TransferStatus().setAppend(true).setLength(2L * 1000L * 1000L).setOffset(5 * 1000L * 1000L); feature.upload(new B2WriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, append, - new DisabledLoginCallback()); + new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertEquals(6 * 1000L * 1000L, count.getSent()); assertTrue(append.isComplete()); assertEquals(content.length, append.getResponse().getSize()); diff --git a/backblaze/src/test/java/ch/cyberduck/core/b2/B2ReadFeatureTest.java b/backblaze/src/test/java/ch/cyberduck/core/b2/B2ReadFeatureTest.java index f95eb2da400..e0ff0a5e6b6 100644 --- a/backblaze/src/test/java/ch/cyberduck/core/b2/B2ReadFeatureTest.java +++ b/backblaze/src/test/java/ch/cyberduck/core/b2/B2ReadFeatureTest.java @@ -32,6 +32,7 @@ import ch.cyberduck.core.io.StreamCopier; import ch.cyberduck.core.shared.DefaultDownloadFeature; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -128,10 +129,10 @@ public void testReadRange() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - final BaseB2Response reply = new B2SingleUploadService(session).upload( + final BaseB2Response reply = new B2SingleUploadService().upload( new B2WriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); @@ -160,10 +161,10 @@ public void testReadRangeUnknownLength() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new B2SingleUploadService(session).upload( + new B2SingleUploadService().upload( new B2WriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final TransferStatus status = new TransferStatus(); status.setLength(-1L); status.setAppend(true); diff --git a/backblaze/src/test/java/ch/cyberduck/core/b2/B2SingleUploadServiceTest.java b/backblaze/src/test/java/ch/cyberduck/core/b2/B2SingleUploadServiceTest.java index f25c4864690..9c54a078923 100644 --- a/backblaze/src/test/java/ch/cyberduck/core/b2/B2SingleUploadServiceTest.java +++ b/backblaze/src/test/java/ch/cyberduck/core/b2/B2SingleUploadServiceTest.java @@ -28,6 +28,7 @@ import ch.cyberduck.core.io.SHA1ChecksumCompute; import ch.cyberduck.core.io.StreamCopier; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -61,9 +62,9 @@ public void testUpload() throws Exception { final Checksum checksum = new SHA1ChecksumCompute().compute(new ByteArrayInputStream(content), new TransferStatus()); status.setChecksum(checksum); final B2VersionIdProvider fileid = new B2VersionIdProvider(session); - final B2SingleUploadService upload = new B2SingleUploadService(session); + final B2SingleUploadService upload = new B2SingleUploadService(); upload.upload(new B2WriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), - status, new DisabledConnectionCallback()); + status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertEquals(checksum, new B2AttributesFinderFeature(session, fileid).find(test).getChecksum()); status.validate(); assertTrue(status.isComplete()); diff --git a/backblaze/src/test/java/ch/cyberduck/core/cryptomator/B2LargeUploadServiceTest.java b/backblaze/src/test/java/ch/cyberduck/core/cryptomator/B2LargeUploadServiceTest.java index 868c5e95afb..48b29e97c80 100644 --- a/backblaze/src/test/java/ch/cyberduck/core/cryptomator/B2LargeUploadServiceTest.java +++ b/backblaze/src/test/java/ch/cyberduck/core/cryptomator/B2LargeUploadServiceTest.java @@ -44,6 +44,7 @@ import ch.cyberduck.core.transfer.Transfer; import ch.cyberduck.core.transfer.TransferItem; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.DefaultVaultRegistry; import ch.cyberduck.core.vault.VaultCredentials; import ch.cyberduck.test.IntegrationTest; @@ -93,7 +94,7 @@ public void testWrite() throws Exception { writeStatus.setLength(content.length); final Path test = new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); final BytecountStreamListener counter = new BytecountStreamListener(); - service.upload(new CryptoWriteFeature<>(session, new B2WriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), counter, writeStatus, new DisabledConnectionCallback()); + service.upload(new CryptoWriteFeature<>(session, new B2WriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), counter, writeStatus, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length, counter.getSent()); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new B2FindFeature(session, fileid)).find(test)); @@ -129,7 +130,7 @@ public void testUploadWithBulk() throws Exception { final Local local = new Local(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString()); IOUtils.write(content, local.getOutputStream(false)); final BytecountStreamListener counter = new BytecountStreamListener(); - service.upload(new CryptoWriteFeature<>(session, new B2WriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), counter, writeStatus, new DisabledConnectionCallback()); + service.upload(new CryptoWriteFeature<>(session, new B2WriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), counter, writeStatus, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length, counter.getSent()); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new B2FindFeature(session, fileid)).find(test)); diff --git a/backblaze/src/test/java/ch/cyberduck/core/worker/B2ConcurrentTransferWorkerTest.java b/backblaze/src/test/java/ch/cyberduck/core/worker/B2ConcurrentTransferWorkerTest.java index 43086803608..9bc5b3d8ffe 100644 --- a/backblaze/src/test/java/ch/cyberduck/core/worker/B2ConcurrentTransferWorkerTest.java +++ b/backblaze/src/test/java/ch/cyberduck/core/worker/B2ConcurrentTransferWorkerTest.java @@ -43,6 +43,7 @@ import ch.cyberduck.core.transfer.TransferSpeedometer; import ch.cyberduck.core.transfer.TransferStatus; import ch.cyberduck.core.transfer.UploadTransfer; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.DefaultVaultRegistry; import ch.cyberduck.test.IntegrationTest; @@ -56,7 +57,6 @@ import java.io.InputStream; import java.io.OutputStream; import java.net.SocketTimeoutException; -import java.security.MessageDigest; import java.util.Collections; import java.util.EnumSet; import java.util.Random; @@ -113,7 +113,7 @@ public Session create() { final B2LargeUploadService upload = new B2LargeUploadService(this, new B2VersionIdProvider(this) ) { @Override - protected InputStream decorate(final InputStream in, final MessageDigest digest) { + protected InputStream decorate(final InputStream in, final UploadFilterOptions options) { if(failed.get()) { // Second attempt successful return in; diff --git a/backblaze/src/test/java/ch/cyberduck/core/worker/B2SingleTransferWorkerTest.java b/backblaze/src/test/java/ch/cyberduck/core/worker/B2SingleTransferWorkerTest.java index 78865392ad9..4433504b3ac 100644 --- a/backblaze/src/test/java/ch/cyberduck/core/worker/B2SingleTransferWorkerTest.java +++ b/backblaze/src/test/java/ch/cyberduck/core/worker/B2SingleTransferWorkerTest.java @@ -49,6 +49,7 @@ import ch.cyberduck.core.transfer.TransferOptions; import ch.cyberduck.core.transfer.TransferSpeedometer; import ch.cyberduck.core.transfer.UploadTransfer; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import ch.cyberduck.test.VaultTest; @@ -61,7 +62,6 @@ import java.io.InputStream; import java.io.OutputStream; import java.net.SocketTimeoutException; -import java.security.MessageDigest; import java.util.Collections; import java.util.EnumSet; import java.util.Random; @@ -110,7 +110,7 @@ public String getProperty(final String key) { final B2LargeUploadService upload = new B2LargeUploadService(this, new B2VersionIdProvider(this) ) { @Override - protected InputStream decorate(final InputStream in, final MessageDigest digest) { + protected InputStream decorate(final InputStream in, final UploadFilterOptions options) { if(failed.get()) { // Second attempt successful return in; diff --git a/box/src/main/java/ch/cyberduck/core/box/BoxLargeUploadService.java b/box/src/main/java/ch/cyberduck/core/box/BoxLargeUploadService.java index 9dd7f0d7cfa..77c7f4a4b86 100644 --- a/box/src/main/java/ch/cyberduck/core/box/BoxLargeUploadService.java +++ b/box/src/main/java/ch/cyberduck/core/box/BoxLargeUploadService.java @@ -41,10 +41,11 @@ import ch.cyberduck.core.transfer.SegmentRetryCallable; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.security.MessageDigest; import java.text.MessageFormat; import java.util.ArrayList; import java.util.HashMap; @@ -54,7 +55,7 @@ import java.util.concurrent.Future; import java.util.stream.Collectors; -public class BoxLargeUploadService extends HttpUploadFeature { +public class BoxLargeUploadService extends HttpUploadFeature { private static final Logger log = LogManager.getLogger(BoxLargeUploadService.class); public static final String UPLOAD_SESSION_ID = "uploadSessionId"; @@ -77,7 +78,7 @@ public BoxLargeUploadService(final BoxSession session, final BoxFileidProvider f @Override public File upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { + final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { final ThreadPool pool = ThreadPoolFactory.get("multipart", concurrency); try { if(status.getChecksum().algorithm != HashAlgorithm.sha1) { @@ -91,7 +92,7 @@ public File upload(final Write write, final Path file, final Local local, for(int partNumber = 1; remaining > 0; partNumber++) { final long length = Math.min(uploadSession.getPartSize(), remaining); parts.add(this.submit(pool, write, file, local, throttle, streamListener, status, - uploadSession.getId(), partNumber, offset, length, callback)); + uploadSession.getId(), partNumber, offset, length, callback, options)); remaining -= length; offset += length; } @@ -119,7 +120,7 @@ public File upload(final Write write, final Path file, final Local local, private Future submit(final ThreadPool pool, final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, - final TransferStatus overall, final String uploadSessionId, final int partNumber, final long offset, final long length, final ConnectionCallback callback) { + final TransferStatus overall, final String uploadSessionId, final int partNumber, final long offset, final long length, final ConnectionCallback callback, final UploadFilterOptions options) { log.info("Submit {} to queue with offset {} and length {}", file, offset, length); final BytecountStreamListener counter = new BytecountStreamListener(listener); return pool.execute(new SegmentRetryCallable<>(session.getHost(), new BackgroundExceptionCallable() { @@ -137,8 +138,8 @@ public Part call() throws BackgroundException { parameters.put(UPLOAD_SESSION_ID, uploadSessionId); parameters.put(OVERALL_LENGTH, String.valueOf(overall.getLength())); status.setParameters(parameters); - final File response = BoxLargeUploadService.this.upload( - write, file, local, throttle, listener, status, overall, status, callback); + final File response = BoxLargeUploadService.this.transfer( + write, file, local, throttle, listener, status, overall, status, callback, options); log.info("Received response {} for part {}", response, partNumber); return new Part(response, status); } diff --git a/box/src/main/java/ch/cyberduck/core/box/BoxSmallUploadService.java b/box/src/main/java/ch/cyberduck/core/box/BoxSmallUploadService.java index 9fc312d39bc..89e56cd5ddf 100644 --- a/box/src/main/java/ch/cyberduck/core/box/BoxSmallUploadService.java +++ b/box/src/main/java/ch/cyberduck/core/box/BoxSmallUploadService.java @@ -18,7 +18,5 @@ import ch.cyberduck.core.box.io.swagger.client.model.File; import ch.cyberduck.core.http.HttpUploadFeature; -import java.security.MessageDigest; - -public class BoxSmallUploadService extends HttpUploadFeature { +public class BoxSmallUploadService extends HttpUploadFeature { } diff --git a/box/src/main/java/ch/cyberduck/core/box/BoxThresholdUploadService.java b/box/src/main/java/ch/cyberduck/core/box/BoxThresholdUploadService.java index 46bea05e2f4..4c15cfca3d6 100644 --- a/box/src/main/java/ch/cyberduck/core/box/BoxThresholdUploadService.java +++ b/box/src/main/java/ch/cyberduck/core/box/BoxThresholdUploadService.java @@ -28,6 +28,7 @@ import ch.cyberduck.core.io.StreamListener; import ch.cyberduck.core.preferences.HostPreferencesFactory; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.VaultRegistry; public class BoxThresholdUploadService implements Upload { @@ -44,14 +45,14 @@ public BoxThresholdUploadService(final BoxSession session, final BoxFileidProvid @Override public File upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { + final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { if(this.threshold(status.getLength())) { if(Vault.DISABLED == registry.find(session, file)) { - return new BoxLargeUploadService(session, fileid).upload(write, file, local, throttle, progress, streamListener, status, callback); + return new BoxLargeUploadService(session, fileid).upload(write, file, local, throttle, progress, streamListener, status, callback, options); } // Cannot comply with chunk size requirement from server } - return new BoxSmallUploadService().upload(write, file, local, throttle, progress, streamListener, status, callback); + return new BoxSmallUploadService().upload(write, file, local, throttle, progress, streamListener, status, callback, options); } protected boolean threshold(final Long length) { diff --git a/box/src/test/java/ch/cyberduck/core/box/BoxLargeUploadServiceTest.java b/box/src/test/java/ch/cyberduck/core/box/BoxLargeUploadServiceTest.java index 2112d9f4455..ae749319fab 100644 --- a/box/src/test/java/ch/cyberduck/core/box/BoxLargeUploadServiceTest.java +++ b/box/src/test/java/ch/cyberduck/core/box/BoxLargeUploadServiceTest.java @@ -28,6 +28,7 @@ import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.SHA1ChecksumCompute; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -58,7 +59,7 @@ public void testUploadLargeFileInChunks() throws Exception { status.setChecksum(new SHA1ChecksumCompute().compute(local.getInputStream(), new TransferStatus())); status.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); - final File response = s.upload(new BoxWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback()); + final File response = s.upload(new BoxWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertTrue(status.isComplete()); assertNotNull(response.getSha1()); assertEquals(content.length, count.getSent()); diff --git a/box/src/test/java/ch/cyberduck/core/cryptomator/BoxThresholdUploadServiceTest.java b/box/src/test/java/ch/cyberduck/core/cryptomator/BoxThresholdUploadServiceTest.java index 1c604e5f503..eaa6da4d0b6 100644 --- a/box/src/test/java/ch/cyberduck/core/cryptomator/BoxThresholdUploadServiceTest.java +++ b/box/src/test/java/ch/cyberduck/core/cryptomator/BoxThresholdUploadServiceTest.java @@ -45,6 +45,7 @@ import ch.cyberduck.core.transfer.Transfer; import ch.cyberduck.core.transfer.TransferItem; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.DefaultVaultRegistry; import ch.cyberduck.core.vault.VaultCredentials; import ch.cyberduck.test.IntegrationTest; @@ -94,7 +95,7 @@ public void testUploadVaultWithBulkFeature() throws Exception { final CryptoUploadFeature feature = new CryptoUploadFeature<>(session, new BoxThresholdUploadService(session, fileid, registry), cryptomator); - feature.upload(new BoxWriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, new DisabledConnectionCallback()); + feature.upload(new BoxWriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length, count.getSent()); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new BoxFindFeature(session, fileid)).find(test)); diff --git a/brick/src/main/java/ch/cyberduck/core/brick/BrickThresholdUploadFeature.java b/brick/src/main/java/ch/cyberduck/core/brick/BrickThresholdUploadFeature.java index 4fc8435a526..72a210bedac 100644 --- a/brick/src/main/java/ch/cyberduck/core/brick/BrickThresholdUploadFeature.java +++ b/brick/src/main/java/ch/cyberduck/core/brick/BrickThresholdUploadFeature.java @@ -26,6 +26,7 @@ import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.StreamListener; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; public class BrickThresholdUploadFeature implements Upload { @@ -36,9 +37,9 @@ public BrickThresholdUploadFeature(final BrickSession session) { } @Override - public FileEntity upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { + public FileEntity upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { if(status.getLength() > 0) { - return new BrickUploadFeature(session).upload(write, file, local, throttle, progress, streamListener, status, callback); + return new BrickUploadFeature(session).upload(write, file, local, throttle, progress, streamListener, status, callback, options); } else { new BrickTouchFeature(session).touch(write, file, status); diff --git a/brick/src/main/java/ch/cyberduck/core/brick/BrickUploadFeature.java b/brick/src/main/java/ch/cyberduck/core/brick/BrickUploadFeature.java index 6b38abf6525..e039866c837 100644 --- a/brick/src/main/java/ch/cyberduck/core/brick/BrickUploadFeature.java +++ b/brick/src/main/java/ch/cyberduck/core/brick/BrickUploadFeature.java @@ -42,19 +42,20 @@ import ch.cyberduck.core.transfer.SegmentRetryCallable; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; + import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.joda.time.DateTime; -import java.security.MessageDigest; import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.concurrent.Future; import java.util.stream.Collectors; -public class BrickUploadFeature extends HttpUploadFeature { +public class BrickUploadFeature extends HttpUploadFeature { private static final Logger log = LogManager.getLogger(BrickUploadFeature.class); /** @@ -79,7 +80,7 @@ public BrickUploadFeature(final BrickSession session, final Long partsize, final @Override public FileEntity upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { + final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { final ThreadPool pool = ThreadPoolFactory.get("multipart", concurrency); try { // Full size of file @@ -98,7 +99,7 @@ public FileEntity upload(final Write write, final Path file, final L length = remaining; } parts.add(this.submit(pool, write, file, local, throttle, streamListener, status, - uploadPartEntity.getUploadUri(), partNumber, offset, length, callback)); + uploadPartEntity.getUploadUri(), partNumber, offset, length, callback, options)); remaining -= length; offset += length; ref = uploadPartEntity.getRef(); @@ -152,7 +153,7 @@ protected FileEntity completeUpload(final Path file, final String ref, final Tra private Future submit(final ThreadPool pool, final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus overall, final String url, final Integer partNumber, - final long offset, final long length, final ConnectionCallback callback) throws ConnectionCanceledException { + final long offset, final long length, final ConnectionCallback callback, final UploadFilterOptions options) throws ConnectionCanceledException { overall.validate(); log.info("Submit part {} of {} to queue with offset {} and length {}", partNumber, file, offset, length); final BytecountStreamListener counter = new BytecountStreamListener(listener); @@ -168,8 +169,8 @@ public TransferStatus call() throws BackgroundException { status.setUrl(url); status.setPart(partNumber); status.setHeader(overall.getHeader()); - BrickUploadFeature.super.upload( - write, file, local, throttle, listener, status, overall, status, callback); + BrickUploadFeature.super.transfer( + write, file, local, throttle, listener, status, overall, status, callback, options); log.info("Received response for part number {}", partNumber); return status; } diff --git a/brick/src/main/java/ch/cyberduck/core/brick/BrickWriteFeature.java b/brick/src/main/java/ch/cyberduck/core/brick/BrickWriteFeature.java index 878b983ddd3..36992b064c0 100644 --- a/brick/src/main/java/ch/cyberduck/core/brick/BrickWriteFeature.java +++ b/brick/src/main/java/ch/cyberduck/core/brick/BrickWriteFeature.java @@ -88,24 +88,6 @@ public FileEntity call(final HttpEntity entity) throws BackgroundException { case HttpStatus.SC_OK: log.info("Received response {} for part number {}", response, status.getPart()); // Upload complete - if(response.containsHeader("ETag")) { - if(file.getType().contains(Path.Type.encrypted)) { - log.warn("Skip checksum verification for {} with client side encryption enabled", file); - } - else { - if(HashAlgorithm.md5.equals(status.getChecksum().algorithm)) { - final Checksum etag = Checksum.parse(StringUtils.remove(response.getFirstHeader("ETag").getValue(), '"')); - if(!status.getChecksum().equals(etag)) { - throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()), - MessageFormat.format("Mismatch between {0} hash {1} of uploaded data and ETag {2} returned by the server", - etag.algorithm.toString(), status.getChecksum().hash, etag.hash)); - } - } - } - } - else { - log.debug("No ETag header in response available"); - } return null; default: EntityUtils.updateEntity(response, new BufferedHttpEntity(response.getEntity())); diff --git a/brick/src/test/java/ch/cyberduck/core/brick/BrickCopyFeatureTest.java b/brick/src/test/java/ch/cyberduck/core/brick/BrickCopyFeatureTest.java index bf7a5ebf11e..638e2db1b37 100644 --- a/brick/src/test/java/ch/cyberduck/core/brick/BrickCopyFeatureTest.java +++ b/brick/src/test/java/ch/cyberduck/core/brick/BrickCopyFeatureTest.java @@ -28,6 +28,7 @@ import ch.cyberduck.core.shared.DefaultFindFeature; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -64,7 +65,7 @@ public void testCopyFile() throws Exception { IOUtils.write(random, local.getOutputStream(false)); final TransferStatus status = new TransferStatus().setLength(random.length); new BrickUploadFeature(session).upload(new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); local.delete(); assertTrue(new BrickFindFeature(session).find(test)); final Path copy = new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); @@ -85,7 +86,7 @@ public void testCopyToExistingFile() throws Exception { IOUtils.write(random, local.getOutputStream(false)); final TransferStatus status = new TransferStatus().setLength(random.length); new BrickUploadFeature(session).upload(new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); local.delete(); assertTrue(new BrickFindFeature(session).find(test)); final Path copy = new Path(folder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); @@ -108,7 +109,7 @@ public void testCopyDirectory() throws Exception { IOUtils.write(random, local.getOutputStream(false)); final TransferStatus status = new TransferStatus().setLength(random.length); new BrickUploadFeature(session).upload(new BrickWriteFeature(session), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); local.delete(); assertTrue(new BrickFindFeature(session).find(file)); final Path copy = new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)); diff --git a/brick/src/test/java/ch/cyberduck/core/brick/BrickDeleteFeatureTest.java b/brick/src/test/java/ch/cyberduck/core/brick/BrickDeleteFeatureTest.java index 1b1aa02c0c5..c3dff03059e 100644 --- a/brick/src/test/java/ch/cyberduck/core/brick/BrickDeleteFeatureTest.java +++ b/brick/src/test/java/ch/cyberduck/core/brick/BrickDeleteFeatureTest.java @@ -25,6 +25,7 @@ import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -51,7 +52,7 @@ public void testDeleteWithLock() throws Exception { IOUtils.write(random, local.getOutputStream(false)); final TransferStatus status = new TransferStatus().setLength(random.length); new BrickUploadFeature(session).upload(new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); local.delete(); final String lock = new BrickLockFeature(session).lock(test); assertNotNull(lock); diff --git a/brick/src/test/java/ch/cyberduck/core/brick/BrickLockFeatureTest.java b/brick/src/test/java/ch/cyberduck/core/brick/BrickLockFeatureTest.java index 89a980fb9ff..ab0b76a10ed 100644 --- a/brick/src/test/java/ch/cyberduck/core/brick/BrickLockFeatureTest.java +++ b/brick/src/test/java/ch/cyberduck/core/brick/BrickLockFeatureTest.java @@ -27,6 +27,7 @@ import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -56,7 +57,7 @@ public void testLock() throws Exception { final Path test = new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); final BrickUploadFeature upload = new BrickUploadFeature(session); upload.upload(new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertTrue(new BrickFindFeature(session).find(test)); final BrickLockFeature feature = new BrickLockFeature(session); final String lockid = feature.lock(test); diff --git a/brick/src/test/java/ch/cyberduck/core/brick/BrickMoveFeatureTest.java b/brick/src/test/java/ch/cyberduck/core/brick/BrickMoveFeatureTest.java index 260ed83dc36..1ffc9b9a0fd 100644 --- a/brick/src/test/java/ch/cyberduck/core/brick/BrickMoveFeatureTest.java +++ b/brick/src/test/java/ch/cyberduck/core/brick/BrickMoveFeatureTest.java @@ -30,6 +30,7 @@ import ch.cyberduck.core.synchronization.Comparison; import ch.cyberduck.core.synchronization.ComparisonService; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -96,7 +97,7 @@ public void testMoveWithLock() throws Exception { IOUtils.write(random, local.getOutputStream(false)); final TransferStatus status = new TransferStatus().setLength(random.length); new BrickUploadFeature(session).upload(new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); local.delete(); final String lock = new BrickLockFeature(session).lock(test); final Path target = new BrickMoveFeature(session).move(test, diff --git a/brick/src/test/java/ch/cyberduck/core/brick/BrickReadFeatureTest.java b/brick/src/test/java/ch/cyberduck/core/brick/BrickReadFeatureTest.java index ac0201acfd6..7785722ec4c 100644 --- a/brick/src/test/java/ch/cyberduck/core/brick/BrickReadFeatureTest.java +++ b/brick/src/test/java/ch/cyberduck/core/brick/BrickReadFeatureTest.java @@ -29,6 +29,7 @@ import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.io.StreamCopier; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -106,7 +107,7 @@ public void testReadRange() throws Exception { upload.setExists(true); new BrickUploadFeature(session).upload( new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), upload, - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); @@ -138,7 +139,7 @@ public void testReadRangeUnknownLength() throws Exception { upload.setExists(true); new BrickUploadFeature(session).upload( new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), upload, - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final TransferStatus status = new TransferStatus(); status.setLength(-1L); status.setAppend(true); diff --git a/brick/src/test/java/ch/cyberduck/core/brick/BrickThresholdUploadFeatureTest.java b/brick/src/test/java/ch/cyberduck/core/brick/BrickThresholdUploadFeatureTest.java index 74fe3975b44..f16b15472da 100644 --- a/brick/src/test/java/ch/cyberduck/core/brick/BrickThresholdUploadFeatureTest.java +++ b/brick/src/test/java/ch/cyberduck/core/brick/BrickThresholdUploadFeatureTest.java @@ -26,6 +26,7 @@ import ch.cyberduck.core.features.Delete; import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -55,7 +56,7 @@ public void testUploadZeroLength() throws Exception { status.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); feature.upload(new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), count, status, new DisabledLoginCallback()); + new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length, count.getSent()); assertTrue(new BrickFindFeature(session).find(test)); final PathAttributes attributes = new BrickAttributesFinderFeature(session).find(test); @@ -81,7 +82,7 @@ public void testUpload() throws Exception { status.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); feature.upload(new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), count, status, new DisabledLoginCallback()); + new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); assertTrue(new BrickFindFeature(session).find(test)); diff --git a/brick/src/test/java/ch/cyberduck/core/brick/BrickUploadFeatureTest.java b/brick/src/test/java/ch/cyberduck/core/brick/BrickUploadFeatureTest.java index 71b23104823..e75dd4957fc 100644 --- a/brick/src/test/java/ch/cyberduck/core/brick/BrickUploadFeatureTest.java +++ b/brick/src/test/java/ch/cyberduck/core/brick/BrickUploadFeatureTest.java @@ -26,6 +26,7 @@ import ch.cyberduck.core.features.Delete; import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -57,7 +58,7 @@ public void testUploadSmallPart() throws Exception { status.setMime("text/plain"); final BytecountStreamListener count = new BytecountStreamListener(); feature.upload(new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), count, status, new DisabledLoginCallback()); + new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); assertNotSame(PathAttributes.EMPTY, status.getResponse()); @@ -86,7 +87,7 @@ public void testUploadSinglePart() throws Exception { status.setMime("text/plain"); final BytecountStreamListener count = new BytecountStreamListener(); feature.upload(new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), count, status, new DisabledLoginCallback()); + new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); assertNotSame(PathAttributes.EMPTY, status.getResponse()); @@ -113,7 +114,7 @@ public void testUploadMultipleParts() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); - feature.upload(new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback()); + feature.upload(new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); assertNotSame(PathAttributes.EMPTY, status.getResponse()); diff --git a/brick/src/test/java/ch/cyberduck/core/worker/CopyWorkerTest.java b/brick/src/test/java/ch/cyberduck/core/worker/CopyWorkerTest.java index ab54439a446..da85eb3ebab 100644 --- a/brick/src/test/java/ch/cyberduck/core/worker/CopyWorkerTest.java +++ b/brick/src/test/java/ch/cyberduck/core/worker/CopyWorkerTest.java @@ -32,6 +32,7 @@ import ch.cyberduck.core.pool.SessionPool; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -59,7 +60,7 @@ public void testCopyFile() throws Exception { IOUtils.write(random, local.getOutputStream(false)); final TransferStatus status = new TransferStatus().setLength(random.length); new BrickUploadFeature(session).upload(new BrickWriteFeature(session), source, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertTrue(new BrickFindFeature(session).find(source)); final CopyWorker worker = new CopyWorker(Collections.singletonMap(source, target), new SessionPool.SingleSessionPool(session), PathCache.empty(), new DisabledProgressListener(), new DisabledConnectionCallback()); worker.run(session); @@ -79,7 +80,7 @@ public void testCopyFileToDirectory() throws Exception { IOUtils.write(random, local.getOutputStream(false)); final TransferStatus status = new TransferStatus().setLength(random.length); new BrickUploadFeature(session).upload(new BrickWriteFeature(session), sourceFile, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertTrue(new BrickFindFeature(session).find(sourceFile)); final Path targetFolder = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)); final Path targetFile = new Path(targetFolder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); @@ -105,7 +106,7 @@ public void testCopyDirectory() throws Exception { IOUtils.write(random, local.getOutputStream(false)); final TransferStatus status = new TransferStatus().setLength(random.length); new BrickUploadFeature(session).upload(new BrickWriteFeature(session), sourceFile, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertTrue(new BrickFindFeature(session).find(folder)); assertTrue(new BrickFindFeature(session).find(sourceFile)); final Path targetFolder = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)); diff --git a/core/src/main/java/ch/cyberduck/core/Session.java b/core/src/main/java/ch/cyberduck/core/Session.java index b0068fefa45..6086904454e 100644 --- a/core/src/main/java/ch/cyberduck/core/Session.java +++ b/core/src/main/java/ch/cyberduck/core/Session.java @@ -291,7 +291,7 @@ public T getFeature(final Class type, final T feature) { @SuppressWarnings("unchecked") public T _getFeature(final Class type) { if(type == Upload.class) { - return (T) new DefaultUploadFeature<>(this); + return (T) new DefaultUploadFeature<>(); } if(type == Download.class) { return (T) new DefaultDownloadFeature(this); diff --git a/core/src/main/java/ch/cyberduck/core/features/Upload.java b/core/src/main/java/ch/cyberduck/core/features/Upload.java index eb1f86afc4f..95b83b46684 100644 --- a/core/src/main/java/ch/cyberduck/core/features/Upload.java +++ b/core/src/main/java/ch/cyberduck/core/features/Upload.java @@ -23,6 +23,7 @@ import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.StreamListener; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; @Optional public interface Upload { @@ -38,10 +39,11 @@ public interface Upload { * @param streamListener Stream copy callback * @param status Transfer status holder * @param callback Prompt + * @param options * @see AttributesAdapter#toAttributes(Reply) */ Reply upload(Write write, Path file, Local local, BandwidthThrottle throttle, final ProgressListener progress, StreamListener streamListener, - TransferStatus status, ConnectionCallback callback) throws BackgroundException; + TransferStatus status, ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException; /** * Determine if appending to file is supported diff --git a/core/src/main/java/ch/cyberduck/core/http/HttpUploadFeature.java b/core/src/main/java/ch/cyberduck/core/http/HttpUploadFeature.java index a29579acb27..df42fe72717 100644 --- a/core/src/main/java/ch/cyberduck/core/http/HttpUploadFeature.java +++ b/core/src/main/java/ch/cyberduck/core/http/HttpUploadFeature.java @@ -17,112 +17,7 @@ * Bug fixes, suggestions and comments should be sent to feedback@cyberduck.ch */ -import ch.cyberduck.core.ConnectionCallback; -import ch.cyberduck.core.Local; -import ch.cyberduck.core.LocaleFactory; -import ch.cyberduck.core.Path; -import ch.cyberduck.core.ProgressListener; -import ch.cyberduck.core.exception.BackgroundException; -import ch.cyberduck.core.exception.ChecksumException; -import ch.cyberduck.core.features.Upload; -import ch.cyberduck.core.features.Write; -import ch.cyberduck.core.io.BandwidthThrottle; -import ch.cyberduck.core.io.Checksum; -import ch.cyberduck.core.io.StatusOutputStream; -import ch.cyberduck.core.io.StreamCancelation; -import ch.cyberduck.core.io.StreamCopier; -import ch.cyberduck.core.io.StreamListener; -import ch.cyberduck.core.io.StreamProgress; -import ch.cyberduck.core.io.ThrottledOutputStream; -import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.shared.DefaultUploadFeature; -import org.apache.commons.codec.binary.Hex; -import org.apache.commons.lang3.ObjectUtils; -import org.apache.http.client.HttpResponseException; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.io.IOException; -import java.io.InputStream; -import java.security.MessageDigest; -import java.text.MessageFormat; - -public class HttpUploadFeature implements Upload { - private static final Logger log = LogManager.getLogger(HttpUploadFeature.class); - - @Override - public Reply upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, - final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { - final Reply response = this.upload(write, file, local, throttle, streamListener, status, status, status, callback); - log.debug("Received response {}", response); - return response; - } - - public Reply upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, - final StreamListener listener, final TransferStatus status, - final StreamCancelation cancel, final StreamProgress progress, final ConnectionCallback callback) throws BackgroundException { - try { - final Digest digest = this.digest(); - final Reply response = this.transfer(write, file, local, throttle, listener, status, cancel, progress, callback, digest); - this.post(file, digest, response); - return response; - } - catch(HttpResponseException e) { - throw new DefaultHttpResponseExceptionMappingService().map("Upload {0} failed", e, file); - } - catch(IOException e) { - throw new HttpExceptionMappingService().map("Upload {0} failed", e, file); - } - } - - protected Reply transfer(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, - final TransferStatus status, final StreamCancelation cancel, final StreamProgress progress, - final ConnectionCallback callback, final Digest digest) throws IOException, BackgroundException { - // Wrap with digest stream if available - final InputStream in = this.decorate(local.getInputStream(), digest); - final StatusOutputStream out = write.write(file, status, callback); - new StreamCopier(cancel, progress) - .withOffset(status.getOffset()) - .withLimit(status.getLength()) - .withListener(listener) - .transfer(in, new ThrottledOutputStream(out, throttle)); - return out.getStatus(); - } - - protected InputStream decorate(final InputStream in, final Digest digest) throws IOException { - return in; - } - - protected Digest digest() throws IOException { - return null; - } - - protected void post(final Path file, final Digest digest, final Reply response) throws BackgroundException { - // No-op with no checksum verification by default - log.debug("Missing checksum verification for {}", file); - } - - protected void verify(final Path file, final MessageDigest digest, final Checksum checksum) throws ChecksumException { - if(file.getType().contains(Path.Type.encrypted)) { - log.warn("Skip checksum verification for {} with client side encryption enabled", file); - return; - } - if(null == digest) { - log.debug("Digest disabled for file {}", file); - return; - } - // Obtain locally-calculated MD5 hash. - final Checksum expected = Checksum.parse(Hex.encodeHexString(digest.digest())); - if(ObjectUtils.notEqual(expected.algorithm, checksum.algorithm)) { - log.warn("ETag {} returned by server is {} but expected {}", checksum.hash, checksum.algorithm, expected.algorithm); - } - else { - // Compare our locally-calculated hash with the ETag returned by S3. - if(!checksum.equals(expected)) { - throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()), - MessageFormat.format("Mismatch between MD5 hash {0} of uploaded data and ETag {1} returned by the server", - expected, checksum.hash)); - } - } - } +public class HttpUploadFeature extends DefaultUploadFeature { } diff --git a/core/src/main/java/ch/cyberduck/core/shared/DefaultUploadFeature.java b/core/src/main/java/ch/cyberduck/core/shared/DefaultUploadFeature.java index 7cc67bec120..18d0fa1b093 100644 --- a/core/src/main/java/ch/cyberduck/core/shared/DefaultUploadFeature.java +++ b/core/src/main/java/ch/cyberduck/core/shared/DefaultUploadFeature.java @@ -19,42 +19,80 @@ */ import ch.cyberduck.core.ConnectionCallback; +import ch.cyberduck.core.DefaultIOExceptionMappingService; import ch.cyberduck.core.Local; import ch.cyberduck.core.Path; import ch.cyberduck.core.ProgressListener; -import ch.cyberduck.core.Session; import ch.cyberduck.core.exception.BackgroundException; import ch.cyberduck.core.features.Upload; import ch.cyberduck.core.features.Write; import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.StatusOutputStream; +import ch.cyberduck.core.io.StreamCancelation; import ch.cyberduck.core.io.StreamCopier; import ch.cyberduck.core.io.StreamListener; +import ch.cyberduck.core.io.StreamProgress; import ch.cyberduck.core.io.ThrottledOutputStream; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.io.IOException; import java.io.InputStream; +import java.security.DigestInputStream; +import java.security.MessageDigest; public class DefaultUploadFeature implements Upload { - - private final Session session; - - public DefaultUploadFeature(final Session session) { - this.session = session; - } + private static final Logger log = LogManager.getLogger(DefaultUploadFeature.class); @Override public Reply upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, - final ConnectionCallback callback) throws BackgroundException { - final InputStream in = local.getInputStream(); + final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + final Reply response = this.transfer(write, file, local, throttle, streamListener, status, status, status, callback, options); + log.debug("Received response {}", response); + return response; + } + + protected Reply transfer(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, + final TransferStatus status, final StreamCancelation cancel, final StreamProgress progress, + final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + final InputStream in = this.decorate(local.getInputStream(), options); final StatusOutputStream out = write.write(file, status, callback); - new StreamCopier(status, status) - .withOffset(status.getOffset()) - .withLimit(status.getLength()) - .withListener(streamListener) - .transfer(in, new ThrottledOutputStream(out, throttle)); + new StreamCopier(cancel, progress) + .withOffset(status.getOffset()) + .withLimit(status.getLength()) + .withListener(listener) + .transfer(in, new ThrottledOutputStream(out, throttle)); return out.getStatus(); } + /** + * Wrap input stream if checksum calculation is enabled. + * + * @param in File input stream + * @param options + * @return Wrapped or same stream + */ + protected InputStream decorate(final InputStream in, final UploadFilterOptions options) throws BackgroundException { + if(options.checksum) { + final MessageDigest digest; + try { + digest = this.digest(); + } + catch(IOException e) { + throw new DefaultIOExceptionMappingService().map(e); + } + if(null != digest) { + return new DigestInputStream(in, digest); + } + } + return in; + } + + protected MessageDigest digest() throws IOException { + return null; + } } diff --git a/core/src/main/java/ch/cyberduck/core/transfer/UploadTransfer.java b/core/src/main/java/ch/cyberduck/core/transfer/UploadTransfer.java index 61844e7e38c..81704620c8d 100644 --- a/core/src/main/java/ch/cyberduck/core/transfer/UploadTransfer.java +++ b/core/src/main/java/ch/cyberduck/core/transfer/UploadTransfer.java @@ -322,7 +322,7 @@ public void transfer(final Session source, final Session destination, fina file.getName())); // Transfer source.getFeature(Upload.class).upload(source.getFeature(Write.class), - file, local, bandwidth, progress, listener, segment, prompt); + file, local, bandwidth, progress, listener, segment, prompt, this.options); } } diff --git a/core/src/main/java/ch/cyberduck/core/transfer/upload/AbstractUploadFilter.java b/core/src/main/java/ch/cyberduck/core/transfer/upload/AbstractUploadFilter.java index 775a74fddbb..0b7272d8641 100644 --- a/core/src/main/java/ch/cyberduck/core/transfer/upload/AbstractUploadFilter.java +++ b/core/src/main/java/ch/cyberduck/core/transfer/upload/AbstractUploadFilter.java @@ -32,6 +32,7 @@ import ch.cyberduck.core.UserDateFormatterFactory; import ch.cyberduck.core.exception.AccessDeniedException; import ch.cyberduck.core.exception.BackgroundException; +import ch.cyberduck.core.exception.ChecksumException; import ch.cyberduck.core.exception.InteroperabilityException; import ch.cyberduck.core.exception.LocalAccessDeniedException; import ch.cyberduck.core.exception.LocalNotfoundException; @@ -48,6 +49,7 @@ import ch.cyberduck.core.features.UnixPermission; import ch.cyberduck.core.features.Versioning; import ch.cyberduck.core.features.Write; +import ch.cyberduck.core.io.Checksum; import ch.cyberduck.core.io.ChecksumCompute; import ch.cyberduck.core.preferences.HostPreferencesFactory; import ch.cyberduck.core.preferences.PreferencesReader; @@ -375,6 +377,22 @@ public void complete(final Path file, final Local local, } } } + if(file.isFile()) { + if(options.checksum) { + final Checksum checksum = status.getChecksum(); + if(Checksum.NONE != checksum) { + final Checksum response = status.getResponse().getChecksum(); + if(Checksum.NONE != response) { + if(!checksum.equals(response)) { + throw new ChecksumException( + MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()), + MessageFormat.format(LocaleFactory.localizedString("Mismatch between {2} checksum {0} of transfered data and {1} returned by the server", "Error"), + response.algorithm.toString(), response.hash, checksum.hash)); + } + } + } + } + } if(file.isFile()) { if(status.getDisplayname().remote != null) { final Move move = session.getFeature(Move.class); diff --git a/core/src/main/java/ch/cyberduck/core/vault/registry/VaultRegistryUploadFeature.java b/core/src/main/java/ch/cyberduck/core/vault/registry/VaultRegistryUploadFeature.java index eb5a5e99dee..ecf09e18041 100644 --- a/core/src/main/java/ch/cyberduck/core/vault/registry/VaultRegistryUploadFeature.java +++ b/core/src/main/java/ch/cyberduck/core/vault/registry/VaultRegistryUploadFeature.java @@ -26,6 +26,7 @@ import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.StreamListener; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.VaultRegistry; public class VaultRegistryUploadFeature implements Upload { @@ -42,9 +43,8 @@ public VaultRegistryUploadFeature(final Session session, final Upload @Override @SuppressWarnings("unchecked") - public Output upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { - return (Output) registry.find(session, file).getFeature(session, Upload.class, proxy).upload( - write, file, local, throttle, progress, streamListener, status, callback); + public Output upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + return (Output) registry.find(session, file).getFeature(session, Upload.class, proxy).upload(write, file, local, throttle, progress, streamListener, status, callback, options); } @Override diff --git a/core/src/test/java/ch/cyberduck/core/NullUploadFeature.java b/core/src/test/java/ch/cyberduck/core/NullUploadFeature.java index cf392e963fa..589e9b8fbf3 100644 --- a/core/src/test/java/ch/cyberduck/core/NullUploadFeature.java +++ b/core/src/test/java/ch/cyberduck/core/NullUploadFeature.java @@ -19,12 +19,13 @@ import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.StreamListener; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; public class NullUploadFeature implements Upload { @Override public Void upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { + final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { return null; } diff --git a/core/src/test/java/ch/cyberduck/core/transfer/upload/ResumeFilterTest.java b/core/src/test/java/ch/cyberduck/core/transfer/upload/ResumeFilterTest.java index 96a8a5ad782..22abd2d3a3d 100644 --- a/core/src/test/java/ch/cyberduck/core/transfer/upload/ResumeFilterTest.java +++ b/core/src/test/java/ch/cyberduck/core/transfer/upload/ResumeFilterTest.java @@ -241,7 +241,7 @@ public AttributedList list(final Path folder, final ListProgressListener l } }; final ResumeFilter f = new ResumeFilter(new DisabledUploadSymlinkResolver(), session, - new DefaultUploadFeature<>(session), new UploadFilterOptions(host).withTemporary(true)); + new DefaultUploadFeature<>(), new UploadFilterOptions(host).withTemporary(true)); final long size = 3L; final Path t = new Path("t", EnumSet.of(Path.Type.file)); final NullLocal l = new NullLocal("t") { diff --git a/cryptomator/src/main/java/ch/cyberduck/core/cryptomator/features/CryptoUploadFeature.java b/cryptomator/src/main/java/ch/cyberduck/core/cryptomator/features/CryptoUploadFeature.java index 2f2c1317338..6f6bb197529 100644 --- a/cryptomator/src/main/java/ch/cyberduck/core/cryptomator/features/CryptoUploadFeature.java +++ b/cryptomator/src/main/java/ch/cyberduck/core/cryptomator/features/CryptoUploadFeature.java @@ -28,6 +28,7 @@ import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.StreamListener; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; public class CryptoUploadFeature implements Upload { @@ -42,8 +43,8 @@ public CryptoUploadFeature(final Session session, final Upload delegat } @Override - public Reply upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { - return proxy.upload(write, vault.encrypt(session, file), local, throttle, progress, streamListener, status.setDestinationLength(new CryptoTransferStatus(vault, status).getLength()), callback); + public Reply upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + return proxy.upload(write, vault.encrypt(session, file), local, throttle, progress, streamListener, status.setDestinationLength(new CryptoTransferStatus(vault, status).getLength()), callback, options); } @Override diff --git a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraConcurrentTransferWorkerTest.java b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraConcurrentTransferWorkerTest.java index 1b68a14520e..82073349aac 100644 --- a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraConcurrentTransferWorkerTest.java +++ b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraConcurrentTransferWorkerTest.java @@ -43,6 +43,7 @@ import ch.cyberduck.core.transfer.TransferOptions; import ch.cyberduck.core.transfer.TransferSpeedometer; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.worker.ConcurrentTransferWorker; import ch.cyberduck.test.IntegrationTest; @@ -69,7 +70,7 @@ public void testBelowSegmentSizeUpAndDownload() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DAVUploadFeature(session).upload(new CteraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), new DisabledConnectionCallback()); + new DAVUploadFeature().upload(new CteraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length, new DAVAttributesFinderFeature(session).find(test).getSize()); final Local localFile = new DefaultTemporaryFileService().create(test.getName()); final Transfer download = new DownloadTransfer(new Host(new TestProtocol()), Collections.singletonList(new TransferItem(test, localFile)), new NullFilter<>()); @@ -97,7 +98,7 @@ public void testLargeUpAndDownload() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DAVUploadFeature(session).upload(new CteraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), new DisabledConnectionCallback()); + new DAVUploadFeature().upload(new CteraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length, new DAVAttributesFinderFeature(session).find(test).getSize()); final Local localFile = new DefaultTemporaryFileService().create(test.getName()); final Transfer download = new DownloadTransfer(new Host(new TestProtocol()), Collections.singletonList(new TransferItem(test, localFile)), new NullFilter<>()); diff --git a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraDirectIOReadFeatureTest.java b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraDirectIOReadFeatureTest.java index 54fe13f55dc..436486c13a9 100644 --- a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraDirectIOReadFeatureTest.java +++ b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraDirectIOReadFeatureTest.java @@ -31,6 +31,7 @@ import ch.cyberduck.core.transfer.Transfer; import ch.cyberduck.core.transfer.TransferItem; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -59,10 +60,10 @@ public void testReadChunk() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DAVUploadFeature(session).upload( + new DAVUploadFeature().upload( new CteraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final TransferStatus status = new TransferStatus(); final TransferStatus segment = new TransferStatus().setSegment(true); status.setSegments(Collections.singletonList(segment)); diff --git a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraReadFeatureTest.java b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraReadFeatureTest.java index 3265ae51a2e..66371e5667e 100644 --- a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraReadFeatureTest.java +++ b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraReadFeatureTest.java @@ -32,6 +32,7 @@ import ch.cyberduck.core.shared.DefaultDownloadFeature; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -75,10 +76,10 @@ public void testReadChunkedTransfer() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DAVUploadFeature(session).upload( + new DAVUploadFeature().upload( new CteraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); // Unknown length in status final TransferStatus status = new TransferStatus() { @Override @@ -123,10 +124,10 @@ public void testReadRange() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DAVUploadFeature(session).upload( + new DAVUploadFeature().upload( new CteraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); @@ -151,10 +152,10 @@ public void testReadRangeUnknownLength() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DAVUploadFeature(session).upload( + new DAVUploadFeature().upload( new CteraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final TransferStatus status = new TransferStatus(); status.setLength(-1L); status.setAppend(true); diff --git a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraWriteFeatureTest.java b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraWriteFeatureTest.java index 91def1b10b2..f55f73a858e 100644 --- a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraWriteFeatureTest.java +++ b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraWriteFeatureTest.java @@ -19,6 +19,7 @@ import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -57,9 +58,9 @@ public void testReadWrite() throws Exception { out.close(); status.setLength(content.length); final Path test = new Path(folder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); - final HttpUploadFeature upload = new DAVUploadFeature(session); + final HttpUploadFeature upload = new DAVUploadFeature(); upload.upload(new CteraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertTrue(session.getFeature(Find.class).find(test)); assertEquals(content.length, new CteraListService(session).list(test.getParent(), new DisabledListProgressListener()) .find(new SimplePathPredicate(test)).attributes().getSize(), 0L); @@ -90,7 +91,7 @@ public void testReplaceContent() throws Exception { new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus()); final Local local = new Local(System.getProperty("java.io.tmpdir"), new AlphanumericRandomStringService().random()); final Path test = new Path(folder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); - final HttpUploadFeature upload = new DAVUploadFeature(session); + final HttpUploadFeature upload = new DAVUploadFeature(); { final byte[] content = RandomUtils.nextBytes(100); final OutputStream out = local.getOutputStream(false); @@ -99,7 +100,7 @@ public void testReplaceContent() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(content.length); upload.upload(new CteraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); } final PathAttributes attr1 = new CteraAttributesFinderFeature(session).find(test); Thread.sleep(1000L); @@ -111,7 +112,7 @@ public void testReplaceContent() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(content.length); upload.upload(new CteraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); } final PathAttributes attr2 = new CteraAttributesFinderFeature(session).find(test); assertEquals(101L, attr2.getSize()); diff --git a/defaults/src/main/resources/default.properties b/defaults/src/main/resources/default.properties index f1ef70f9a72..db024531986 100644 --- a/defaults/src/main/resources/default.properties +++ b/defaults/src/main/resources/default.properties @@ -447,7 +447,6 @@ googledrive.delete.multiple.partition=50 b2.bucket.acl.default=allPrivate b2.listing.chunksize=1000 b2.listing.versioning.enable=true -b2.upload.checksum.verify=true b2.upload.largeobject.auto=true b2.upload.largeobject=true b2.upload.largeobject.concurrency=5 diff --git a/dracoon/src/main/java/ch/cyberduck/core/sds/SDSDirectS3UploadFeature.java b/dracoon/src/main/java/ch/cyberduck/core/sds/SDSDirectS3UploadFeature.java index 31ac56f7911..dcf49fa464a 100644 --- a/dracoon/src/main/java/ch/cyberduck/core/sds/SDSDirectS3UploadFeature.java +++ b/dracoon/src/main/java/ch/cyberduck/core/sds/SDSDirectS3UploadFeature.java @@ -57,6 +57,8 @@ import ch.cyberduck.core.transfer.SegmentRetryCallable; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; + import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -64,7 +66,6 @@ import java.io.IOException; import java.io.InputStream; -import java.security.MessageDigest; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -79,7 +80,7 @@ import com.dracoon.sdk.crypto.model.EncryptedFileKey; import com.fasterxml.jackson.databind.ObjectReader; -public class SDSDirectS3UploadFeature extends HttpUploadFeature { +public class SDSDirectS3UploadFeature extends HttpUploadFeature { private static final Logger log = LogManager.getLogger(SDSDirectS3UploadFeature.class); /** @@ -111,7 +112,7 @@ public SDSDirectS3UploadFeature(final SDSSession session, final SDSNodeIdProvide @Override public Node upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { + final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { final ThreadPool pool = ThreadPoolFactory.get("multipart", concurrency); try { final InputStream in; @@ -150,11 +151,11 @@ public Node upload(final Write write, final Path file, final Local local, new StreamCopier(status, StreamProgress.noop).withAutoclose(false).withLimit(length) .transfer(in, new BufferOutputStream(buffer)); parts.add(this.submit(pool, write, file, temporary, buffer, throttle, streamListener, status, - presignedUrl.getUrl(), presignedUrl.getPartNumber(), 0L, length, callback)); + presignedUrl.getUrl(), presignedUrl.getPartNumber(), 0L, length, callback, options)); } else { parts.add(this.submit(pool, write, file, local, Buffer.noop, throttle, streamListener, status, - presignedUrl.getUrl(), presignedUrl.getPartNumber(), offset, length, callback)); + presignedUrl.getUrl(), presignedUrl.getPartNumber(), offset, length, callback, options)); } remaining -= length; offset += length; @@ -237,7 +238,7 @@ private List retrievePresignedUrls(final CreateFileUploadResponse private Future submit(final ThreadPool pool, final Write write, final Path file, final Local local, final Buffer buffer, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus overall, final String url, final Integer partNumber, - final long offset, final long length, final ConnectionCallback callback) throws ConnectionCanceledException { + final long offset, final long length, final ConnectionCallback callback, final UploadFilterOptions options) throws ConnectionCanceledException { overall.validate(); log.info("Submit part {} of {} to queue with offset {} and length {}", partNumber, file, offset, length); final BytecountStreamListener counter = new BytecountStreamListener(listener); @@ -253,8 +254,8 @@ public TransferStatus call() throws BackgroundException { status.setPart(partNumber); status.setHeader(overall.getHeader()); status.setFilekey(overall.getFilekey()); - final Node node = SDSDirectS3UploadFeature.super.upload( - write, file, local, throttle, counter, status, overall, status, callback); + final Node node = SDSDirectS3UploadFeature.super.transfer( + write, file, local, throttle, counter, status, overall, status, callback, options); log.info("Received response for part number {}", partNumber); // Delete temporary file if any buffer.close(); diff --git a/dracoon/src/main/java/ch/cyberduck/core/sds/SDSSession.java b/dracoon/src/main/java/ch/cyberduck/core/sds/SDSSession.java index 24f09a81f57..3d55f514837 100644 --- a/dracoon/src/main/java/ch/cyberduck/core/sds/SDSSession.java +++ b/dracoon/src/main/java/ch/cyberduck/core/sds/SDSSession.java @@ -606,7 +606,7 @@ public T _getFeature(final Class type) { if(HostPreferencesFactory.get(host).getBoolean("sds.upload.s3.enable")) { return (T) new SDSDirectS3UploadFeature(this, nodeid); } - return (T) new DefaultUploadFeature(this); + return (T) new DefaultUploadFeature(); } if(type == MultipartWrite.class) { if(HostPreferencesFactory.get(host).getBoolean("sds.upload.s3.enable")) { diff --git a/dracoon/src/main/java/ch/cyberduck/core/sds/SDSUploadService.java b/dracoon/src/main/java/ch/cyberduck/core/sds/SDSUploadService.java index ebac6d5cc10..d6d1d433b4a 100644 --- a/dracoon/src/main/java/ch/cyberduck/core/sds/SDSUploadService.java +++ b/dracoon/src/main/java/ch/cyberduck/core/sds/SDSUploadService.java @@ -147,20 +147,8 @@ public Node complete(final Path file, final String uploadToken, final TransferSt } log.debug("Complete file upload for {} with token {}", file, uploadToken); final Node upload = new UploadsApi(session.getClient()).completeFileUploadByToken(uploadToken, body, StringUtils.EMPTY); - if(!upload.isIsEncrypted()) { - final Checksum checksum = status.getChecksum(); - if(Checksum.NONE != checksum) { - final Checksum server = Checksum.parse(upload.getHash()); - if(Checksum.NONE != server) { - if(checksum.algorithm.equals(server.algorithm)) { - if(!server.equals(checksum)) { - throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()), - MessageFormat.format("Mismatch between MD5 hash {0} of uploaded data and ETag {1} returned by the server", - checksum.hash, server.hash)); - } - } - } - } + if(upload.isIsEncrypted()) { + status.setChecksum(Checksum.NONE); } nodeid.cache(file, String.valueOf(upload.getId())); return upload; diff --git a/dracoon/src/test/java/ch/cyberduck/core/sds/SDSDeleteFeatureTest.java b/dracoon/src/test/java/ch/cyberduck/core/sds/SDSDeleteFeatureTest.java index 2f1448b23e9..21d430038df 100644 --- a/dracoon/src/test/java/ch/cyberduck/core/sds/SDSDeleteFeatureTest.java +++ b/dracoon/src/test/java/ch/cyberduck/core/sds/SDSDeleteFeatureTest.java @@ -34,6 +34,7 @@ import ch.cyberduck.core.sds.io.swagger.client.model.RoomPoliciesRequest; import ch.cyberduck.core.shared.DefaultFindFeature; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -155,7 +156,7 @@ public void testDeleteEicar() throws Exception { status.setLength(eicar.length); final SDSDirectS3UploadFeature feature = new SDSDirectS3UploadFeature(session, nodeid); final Node node = feature.upload(new SDSDelegatingWriteFeature(session, nodeid, new SDSDirectS3WriteFeature(session, nodeid)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertTrue(new SDSFindFeature(session, nodeid).find(test)); final PathAttributes attributes = new SDSAttributesFinderFeature(session, nodeid).find(test); assertEquals(eicar.length, attributes.getSize()); diff --git a/dracoon/src/test/java/ch/cyberduck/core/sds/SDSDirectS3UploadFeatureTest.java b/dracoon/src/test/java/ch/cyberduck/core/sds/SDSDirectS3UploadFeatureTest.java index 23d59199018..1ff33732ed9 100644 --- a/dracoon/src/test/java/ch/cyberduck/core/sds/SDSDirectS3UploadFeatureTest.java +++ b/dracoon/src/test/java/ch/cyberduck/core/sds/SDSDirectS3UploadFeatureTest.java @@ -40,6 +40,7 @@ import ch.cyberduck.core.transfer.Transfer; import ch.cyberduck.core.transfer.TransferItem; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.VaultCredentials; import ch.cyberduck.test.IntegrationTest; @@ -83,7 +84,7 @@ public HttpResponseOutputStream write(final Path file, final TransferStatu return super.write(file, status, callback); } }, test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); fail(); } catch(ConnectionCanceledException e) { @@ -111,7 +112,7 @@ public void testUploadZeroByteFile() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(random.length); feature.upload(new SDSDelegatingWriteFeature(session, nodeid, session.getFeature(Write.class)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertTrue(new SDSFindFeature(session, nodeid).find(test)); final PathAttributes attributes = new SDSAttributesFinderFeature(session, nodeid).find(test); assertEquals(random.length, attributes.getSize()); @@ -131,7 +132,7 @@ public void testUploadMissingTargetDirectory() throws Exception { new DefaultLocalTouchFeature().touch(local); final TransferStatus status = new TransferStatus(); assertThrows(NotfoundException.class, () -> feature.upload(new SDSDelegatingWriteFeature(session, nodeid, session.getFeature(Write.class)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost()))); local.delete(); } @@ -150,7 +151,7 @@ public void testUploadBelowMultipartSize() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(random.length); final Node node = feature.upload(new SDSDelegatingWriteFeature(session, nodeid, session.getFeature(Write.class)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertTrue(new SDSFindFeature(session, nodeid).find(test)); final PathAttributes attributes = new SDSAttributesFinderFeature(session, nodeid).find(test); assertEquals(random.length, attributes.getSize()); @@ -174,7 +175,7 @@ public void testUploadExactMultipartSize() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(random.length); final Node node = feature.upload(new SDSDelegatingWriteFeature(session, nodeid, session.getFeature(Write.class)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertTrue(status.isComplete()); assertNotSame(PathAttributes.EMPTY, status.getResponse()); assertTrue(new SDSFindFeature(session, nodeid).find(test)); @@ -200,7 +201,7 @@ public void testUploadMultipleParts() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(random.length); final Node node = feature.upload(new SDSDelegatingWriteFeature(session, nodeid, session.getFeature(Write.class)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertTrue(status.isComplete()); assertNotSame(PathAttributes.EMPTY, status.getResponse()); assertTrue(new SDSFindFeature(session, nodeid).find(test)); @@ -229,7 +230,7 @@ public void testTripleCryptUploadBelowMultipartSize() throws Exception { final SDSEncryptionBulkFeature bulk = new SDSEncryptionBulkFeature(session, nodeid); bulk.pre(Transfer.Type.upload, Collections.singletonMap(new TransferItem(test, local), status), new DisabledConnectionCallback()); final Node node = feature.upload(session.getFeature(Write.class), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertTrue(status.isComplete()); assertNotSame(PathAttributes.EMPTY, status.getResponse()); assertTrue(new SDSFindFeature(session, nodeid).find(test)); @@ -268,7 +269,7 @@ public void testTripleCryptUploadExactMultipartSize() throws Exception { final SDSEncryptionBulkFeature bulk = new SDSEncryptionBulkFeature(session, nodeid); bulk.pre(Transfer.Type.upload, Collections.singletonMap(new TransferItem(test, local), status), new DisabledConnectionCallback()); final Node node = feature.upload(session.getFeature(Write.class), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertTrue(status.isComplete()); assertNotSame(PathAttributes.EMPTY, status.getResponse()); assertTrue(new SDSFindFeature(session, nodeid).find(test)); @@ -307,7 +308,7 @@ public void testTripleCryptUploadMultipleParts() throws Exception { final SDSEncryptionBulkFeature bulk = new SDSEncryptionBulkFeature(session, nodeid); bulk.pre(Transfer.Type.upload, Collections.singletonMap(new TransferItem(test, local), status), new DisabledConnectionCallback()); final Node node = feature.upload(session.getFeature(Write.class), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertTrue(status.isComplete()); assertNotSame(PathAttributes.EMPTY, status.getResponse()); assertTrue(new SDSFindFeature(session, nodeid).find(test)); diff --git a/dracoon/src/test/java/ch/cyberduck/core/sds/SDSReadFeatureTest.java b/dracoon/src/test/java/ch/cyberduck/core/sds/SDSReadFeatureTest.java index a6a8028f2f5..06af7b4e418 100644 --- a/dracoon/src/test/java/ch/cyberduck/core/sds/SDSReadFeatureTest.java +++ b/dracoon/src/test/java/ch/cyberduck/core/sds/SDSReadFeatureTest.java @@ -30,6 +30,7 @@ import ch.cyberduck.core.sds.io.swagger.client.model.Node; import ch.cyberduck.core.shared.DefaultUploadFeature; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -109,9 +110,9 @@ public void testReadRange() throws Exception { out.close(); final TransferStatus upload = new TransferStatus().setLength(content.length); upload.setExists(true); - new DefaultUploadFeature(session).upload( + new DefaultUploadFeature().upload( new SDSDirectS3MultipartWriteFeature(session, nodeid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), upload, - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); @@ -142,9 +143,9 @@ public void testReadRangeUnknownLength() throws Exception { out.close(); final TransferStatus upload = new TransferStatus().setLength(content.length); upload.setExists(true); - new DefaultUploadFeature(session).upload( + new DefaultUploadFeature().upload( new SDSDirectS3MultipartWriteFeature(session, nodeid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), upload, - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final TransferStatus status = new TransferStatus(); status.setLength(-1L); status.setAppend(true); diff --git a/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxSession.java b/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxSession.java index fc008c25ec6..a0d5c66ed71 100644 --- a/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxSession.java +++ b/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxSession.java @@ -149,7 +149,7 @@ public T _getFeature(Class type) { return (T) new DropboxWriteFeature(this); } if(type == Upload.class) { - return (T) new DropboxUploadFeature(this); + return (T) new DropboxUploadFeature(); } if(type == Directory.class) { return (T) new DropboxDirectoryFeature(this); diff --git a/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxUploadFeature.java b/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxUploadFeature.java index 15c90469a92..1ea9b170de0 100644 --- a/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxUploadFeature.java +++ b/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxUploadFeature.java @@ -16,60 +16,23 @@ * GNU General Public License for more details. */ -import ch.cyberduck.core.Path; -import ch.cyberduck.core.exception.BackgroundException; import ch.cyberduck.core.http.HttpUploadFeature; -import ch.cyberduck.core.io.Checksum; -import ch.cyberduck.core.preferences.HostPreferencesFactory; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import java.io.IOException; -import java.io.InputStream; -import java.security.DigestInputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import com.dropbox.core.v2.files.FileMetadata; import com.dropbox.core.v2.files.Metadata; -public class DropboxUploadFeature extends HttpUploadFeature { - private static final Logger log = LogManager.getLogger(DropboxUploadFeature.class); - - final DropboxSession session; - - public DropboxUploadFeature(final DropboxSession session) { - this.session = session; - } - - @Override - protected InputStream decorate(final InputStream in, final MessageDigest digest) throws IOException { - if(null == digest) { - log.warn("Checksum calculation disabled"); - return super.decorate(in, null); - } - else { - return new DigestInputStream(in, digest); - } - } +public class DropboxUploadFeature extends HttpUploadFeature { @Override protected MessageDigest digest() throws IOException { - MessageDigest digest = null; - if(HostPreferencesFactory.get(session.getHost()).getBoolean("queue.upload.checksum.calculate")) { - try { - digest = new DropboxContentHasher(MessageDigest.getInstance("SHA-256"), MessageDigest.getInstance("SHA-256"), 0); - } - catch(NoSuchAlgorithmException e) { - throw new IOException(e.getMessage(), e); - } + try { + return new DropboxContentHasher(MessageDigest.getInstance("SHA-256"), MessageDigest.getInstance("SHA-256"), 0); + } + catch(NoSuchAlgorithmException e) { + throw new IOException(e.getMessage(), e); } - return digest; - } - - @Override - protected void post(final Path file, final MessageDigest digest, final Metadata response) throws BackgroundException { - this.verify(file, digest, Checksum.parse(((FileMetadata) response).getContentHash())); } } diff --git a/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxWriteFeature.java b/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxWriteFeature.java index bc06b98c7be..e291bca132d 100644 --- a/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxWriteFeature.java +++ b/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxWriteFeature.java @@ -21,6 +21,7 @@ import ch.cyberduck.core.exception.BackgroundException; import ch.cyberduck.core.http.AbstractHttpWriteFeature; import ch.cyberduck.core.http.HttpResponseOutputStream; +import ch.cyberduck.core.io.Checksum; import ch.cyberduck.core.io.ChecksumCompute; import ch.cyberduck.core.io.DefaultStreamCloser; import ch.cyberduck.core.preferences.HostPreferencesFactory; @@ -66,6 +67,7 @@ public DropboxWriteFeature(final DropboxSession session, final Long chunksize) { public HttpResponseOutputStream write(final Path file, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { try { final DbxUserFilesRequests files = new DbxUserFilesRequests(session.getClient(file)); + final Checksum checksum = status.getChecksum(); final UploadSessionStartUploader start = files.uploadSessionStart(); new DefaultStreamCloser().close(start.getOutputStream()); final String sessionId = start.finish().getSessionId(); diff --git a/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxReadFeatureTest.java b/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxReadFeatureTest.java index 8ffbb93e7b8..d11aedda2f0 100644 --- a/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxReadFeatureTest.java +++ b/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxReadFeatureTest.java @@ -31,6 +31,7 @@ import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.shared.DefaultUploadFeature; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -91,10 +92,10 @@ public void testReadRange() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DefaultUploadFeature(session).upload( + new DefaultUploadFeature().upload( new DropboxWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); diff --git a/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxUploadFeatureTest.java b/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxUploadFeatureTest.java index bcbeb01f104..12ef049a86e 100644 --- a/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxUploadFeatureTest.java +++ b/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxUploadFeatureTest.java @@ -23,9 +23,11 @@ import ch.cyberduck.core.Local; import ch.cyberduck.core.Path; import ch.cyberduck.core.PathAttributes; +import ch.cyberduck.core.exception.BackgroundException; import ch.cyberduck.core.features.Delete; import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -34,6 +36,7 @@ import org.junit.Test; import org.junit.experimental.categories.Category; +import java.io.InputStream; import java.util.Collections; import java.util.EnumSet; @@ -47,7 +50,7 @@ public class DropboxUploadFeatureTest extends AbstractDropboxTest { @Test public void testUploadSmall() throws Exception { - final DropboxUploadFeature feature = new DropboxUploadFeature(session); + final DropboxUploadFeature feature = new DropboxUploadFeature(); final Path root = new Path("/", EnumSet.of(Path.Type.directory, Path.Type.volume)); final String name = new AlphanumericRandomStringService().random(); final Path test = new Path(root, name, EnumSet.of(Path.Type.file)); @@ -61,7 +64,7 @@ public void testUploadSmall() throws Exception { status.setMime("text/plain"); final BytecountStreamListener count = new BytecountStreamListener(); final Metadata metadata = feature.upload(new DropboxWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), count, status, new DisabledLoginCallback()); + new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); assertTrue(new DropboxFindFeature(session).find(test)); @@ -76,6 +79,11 @@ public void testUploadSmall() throws Exception { @Test public void testDecorate() throws Exception { final NullInputStream n = new NullInputStream(1L); - assertSame(NullInputStream.class, new DropboxUploadFeature(session).decorate(n, null).getClass()); + assertSame(NullInputStream.class, new DropboxUploadFeature() { + @Override + protected InputStream decorate(final InputStream in, final UploadFilterOptions options) throws BackgroundException { + return super.decorate(in, options); + } + }.decorate(n, new UploadFilterOptions(session.getHost())).getClass()); } } \ No newline at end of file diff --git a/eue/src/main/java/ch/cyberduck/core/eue/EueLargeUploadService.java b/eue/src/main/java/ch/cyberduck/core/eue/EueLargeUploadService.java index 586a09581eb..1db63259ae6 100644 --- a/eue/src/main/java/ch/cyberduck/core/eue/EueLargeUploadService.java +++ b/eue/src/main/java/ch/cyberduck/core/eue/EueLargeUploadService.java @@ -39,6 +39,8 @@ import ch.cyberduck.core.transfer.SegmentRetryCallable; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; + import org.apache.commons.codec.DecoderException; import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Hex; @@ -56,7 +58,7 @@ import java.util.Map; import java.util.concurrent.Future; -public class EueLargeUploadService extends HttpUploadFeature { +public class EueLargeUploadService extends HttpUploadFeature { private static final Logger log = LogManager.getLogger(EueLargeUploadService.class); private final EueSession session; @@ -78,7 +80,7 @@ public EueLargeUploadService(final EueSession session, final EueResourceIdProvid @Override public EueWriteFeature.Chunk upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { + final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { final ThreadPool pool = ThreadPoolFactory.get("multipart", concurrency); try { final List> parts = new ArrayList<>(); @@ -127,7 +129,7 @@ public EueWriteFeature.Chunk upload(final Write write, fi } else { throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()), - MessageFormat.format("Mismatch between {0} hash {1} of uploaded data and ETag {2} returned by the server", + MessageFormat.format("Mismatch between {0} hash {1} of transfered data and {2} returned by the server", HashAlgorithm.cdash64, cdash64, completedUploadResponse.getCdash64())); } } @@ -167,8 +169,8 @@ public EueWriteFeature.Chunk call() throws BackgroundException { status.setHeader(overall.getHeader()); status.setChecksum(write.checksum(file, status).compute(local.getInputStream(), status)); status.setUrl(url); - final EueWriteFeature.Chunk chunk = EueLargeUploadService.this.upload( - write, file, local, throttle, listener, status, overall, status, callback); + final EueWriteFeature.Chunk chunk = EueLargeUploadService.this.transfer( + write, file, local, throttle, listener, status, overall, status, callback, new UploadFilterOptions(session.getHost())); log.info("Received response {} for part {}", chunk, partNumber); return chunk; } diff --git a/eue/src/main/java/ch/cyberduck/core/eue/EueSingleUploadService.java b/eue/src/main/java/ch/cyberduck/core/eue/EueSingleUploadService.java index 8db9d525311..5c9b99a7cbb 100644 --- a/eue/src/main/java/ch/cyberduck/core/eue/EueSingleUploadService.java +++ b/eue/src/main/java/ch/cyberduck/core/eue/EueSingleUploadService.java @@ -27,13 +27,13 @@ import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.StreamListener; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; -import java.security.MessageDigest; import java.util.Collections; import static ch.cyberduck.core.eue.EueWriteFeature.RESOURCE_ID; -public class EueSingleUploadService extends HttpUploadFeature { +public class EueSingleUploadService extends HttpUploadFeature { private final EueSession session; private final EueResourceIdProvider fileid; @@ -45,7 +45,7 @@ public EueSingleUploadService(final EueSession session, final EueResourceIdProvi @Override public EueWriteFeature.Chunk upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { + final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { final String uploadUri; final String resourceId; if(status.isExists()) { @@ -62,7 +62,7 @@ public EueWriteFeature.Chunk upload(final Write write, fi status.setParameters(Collections.singletonMap(RESOURCE_ID, resourceId)); status.setUrl(uploadUri); status.setChecksum(write.checksum(file, status).compute(local.getInputStream(), status)); - return super.upload(write, file, local, throttle, progress, streamListener, status, callback); + return super.upload(write, file, local, throttle, progress, streamListener, status, callback, options); } } diff --git a/eue/src/main/java/ch/cyberduck/core/eue/EueThresholdUploadService.java b/eue/src/main/java/ch/cyberduck/core/eue/EueThresholdUploadService.java index d759e0d5e3f..ecfe67b7e92 100644 --- a/eue/src/main/java/ch/cyberduck/core/eue/EueThresholdUploadService.java +++ b/eue/src/main/java/ch/cyberduck/core/eue/EueThresholdUploadService.java @@ -30,6 +30,7 @@ import ch.cyberduck.core.io.StreamListener; import ch.cyberduck.core.preferences.HostPreferencesFactory; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.VaultRegistry; public class EueThresholdUploadService implements Upload { @@ -52,16 +53,16 @@ public EueThresholdUploadService(final EueSession session, final EueResourceIdPr @Override public EueWriteFeature.Chunk upload(final Write write, final Path file, Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback prompt) throws BackgroundException { + final TransferStatus status, final ConnectionCallback prompt, final UploadFilterOptions options) throws BackgroundException { if(status.getLength() >= threshold) { if(Vault.DISABLED == registry.find(session, file)) { // Only allow concurrent write of chunks when not uploading to vault. Write with default feature multiple 4MB chunks in parallel - return new EueLargeUploadService(session, fileid).upload(write, file, local, throttle, progress, streamListener, status, prompt); + return new EueLargeUploadService(session, fileid).upload(write, file, local, throttle, progress, streamListener, status, prompt, options); } // Write with multipart write feature for known file length sequentially 4MB chunks - return new EueUploadService(session).upload(write, file, local, throttle, progress, streamListener, status, prompt); + return new EueUploadService().upload(write, file, local, throttle, progress, streamListener, status, prompt, options); } // Write single chunk smaller than threshold - return new EueSingleUploadService(session, fileid).upload(write, file, local, throttle, progress, streamListener, status, prompt); + return new EueSingleUploadService(session, fileid).upload(write, file, local, throttle, progress, streamListener, status, prompt, options); } } diff --git a/eue/src/main/java/ch/cyberduck/core/eue/EueUploadService.java b/eue/src/main/java/ch/cyberduck/core/eue/EueUploadService.java index 236f3cc696d..9a9fe3ce26f 100644 --- a/eue/src/main/java/ch/cyberduck/core/eue/EueUploadService.java +++ b/eue/src/main/java/ch/cyberduck/core/eue/EueUploadService.java @@ -17,11 +17,5 @@ import ch.cyberduck.core.http.HttpUploadFeature; -import java.security.MessageDigest; - -public class EueUploadService extends HttpUploadFeature { - - public EueUploadService(final EueSession session) { - - } +public class EueUploadService extends HttpUploadFeature { } diff --git a/eue/src/test/java/ch/cyberduck/core/cryptomator/EueSingleUploadServiceTest.java b/eue/src/test/java/ch/cyberduck/core/cryptomator/EueSingleUploadServiceTest.java index 883a1996c04..c838a53dd4e 100644 --- a/eue/src/test/java/ch/cyberduck/core/cryptomator/EueSingleUploadServiceTest.java +++ b/eue/src/test/java/ch/cyberduck/core/cryptomator/EueSingleUploadServiceTest.java @@ -42,6 +42,7 @@ import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.StreamCopier; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.DefaultVaultRegistry; import ch.cyberduck.core.vault.VaultCredentials; import ch.cyberduck.test.IntegrationTest; @@ -86,7 +87,7 @@ public void testUploadVault() throws Exception { final CryptoUploadFeature feature = new CryptoUploadFeature<>(session, new EueSingleUploadService(session, fileid), cryptomator); - feature.upload(new CryptoWriteFeature<>(session, new EueWriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, null); + feature.upload(new CryptoWriteFeature<>(session, new EueWriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, null, new UploadFilterOptions(session.getHost())); assertEquals(content.length, count.getSent()); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new EueFindFeature(session, fileid)).find(test)); diff --git a/eue/src/test/java/ch/cyberduck/core/cryptomator/EueThresholdUploadServiceTest.java b/eue/src/test/java/ch/cyberduck/core/cryptomator/EueThresholdUploadServiceTest.java index 9855b7e9cd1..310b6f1a85d 100644 --- a/eue/src/test/java/ch/cyberduck/core/cryptomator/EueThresholdUploadServiceTest.java +++ b/eue/src/test/java/ch/cyberduck/core/cryptomator/EueThresholdUploadServiceTest.java @@ -45,6 +45,7 @@ import ch.cyberduck.core.transfer.Transfer; import ch.cyberduck.core.transfer.TransferItem; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.DefaultVaultRegistry; import ch.cyberduck.core.vault.VaultCredentials; import ch.cyberduck.test.IntegrationTest; @@ -92,7 +93,7 @@ public void testUploadVault() throws Exception { final CryptoUploadFeature feature = new CryptoUploadFeature<>(session, new EueThresholdUploadService(session, fileid, registry), cryptomator); - feature.upload(new CryptoWriteFeature<>(session, new EueWriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, new DisabledConnectionCallback()); + feature.upload(new CryptoWriteFeature<>(session, new EueWriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length, count.getSent()); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new EueFindFeature(session, fileid)).find(test)); @@ -129,7 +130,7 @@ public void testUploadVaultWithBulkFeature() throws Exception { final CryptoUploadFeature feature = new CryptoUploadFeature<>(session, new EueThresholdUploadService(session, fileid, registry), cryptomator); - feature.upload(new CryptoWriteFeature<>(session, new EueWriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, new DisabledConnectionCallback()); + feature.upload(new CryptoWriteFeature<>(session, new EueWriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length, count.getSent()); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new EueFindFeature(session, fileid)).find(test)); diff --git a/eue/src/test/java/ch/cyberduck/core/cryptomator/EueUploadServiceTest.java b/eue/src/test/java/ch/cyberduck/core/cryptomator/EueUploadServiceTest.java index 27ecf049804..28c79af7240 100644 --- a/eue/src/test/java/ch/cyberduck/core/cryptomator/EueUploadServiceTest.java +++ b/eue/src/test/java/ch/cyberduck/core/cryptomator/EueUploadServiceTest.java @@ -47,6 +47,7 @@ import ch.cyberduck.core.transfer.Transfer; import ch.cyberduck.core.transfer.TransferItem; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.DefaultVaultRegistry; import ch.cyberduck.core.vault.VaultCredentials; import ch.cyberduck.test.IntegrationTest; @@ -91,9 +92,9 @@ public void testUploadVault() throws Exception { writeStatus.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); final CryptoUploadFeature feature = new CryptoUploadFeature<>(session, - new EueUploadService(session), + new EueUploadService(), cryptomator); - feature.upload(new CryptoWriteFeature<>(session, new EueMultipartWriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, new DisabledConnectionCallback()); + feature.upload(new CryptoWriteFeature<>(session, new EueMultipartWriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length, count.getSent()); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new EueFindFeature(session, fileid)).find(test)); @@ -127,9 +128,9 @@ public void testUploadVaultWithBulkFeature() throws Exception { bulk.pre(Transfer.Type.upload, Collections.singletonMap(new TransferItem(test), writeStatus), new DisabledConnectionCallback()); final BytecountStreamListener count = new BytecountStreamListener(); final CryptoUploadFeature feature = new CryptoUploadFeature<>(session, - new EueUploadService(session), + new EueUploadService(), cryptomator); - feature.upload(new CryptoWriteFeature<>(session, new EueMultipartWriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, new DisabledConnectionCallback()); + feature.upload(new CryptoWriteFeature<>(session, new EueMultipartWriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length, count.getSent()); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new EueFindFeature(session, fileid)).find(test)); diff --git a/eue/src/test/java/ch/cyberduck/core/eue/EueCopyFeatureTest.java b/eue/src/test/java/ch/cyberduck/core/eue/EueCopyFeatureTest.java index c23175252a6..9cb9a307029 100644 --- a/eue/src/test/java/ch/cyberduck/core/eue/EueCopyFeatureTest.java +++ b/eue/src/test/java/ch/cyberduck/core/eue/EueCopyFeatureTest.java @@ -30,6 +30,7 @@ import ch.cyberduck.core.shared.DefaultFindFeature; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -175,7 +176,7 @@ public void testCopyToExistingFile() throws Exception { final TransferStatus status = new TransferStatus().setLength(random.length); final EueWriteFeature.Chunk upload = new EueSingleUploadService(session, fileid).upload(new EueWriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertNotNull(upload.getResourceId()); local.delete(); assertTrue(new EueFindFeature(session, fileid).find(test)); diff --git a/eue/src/test/java/ch/cyberduck/core/eue/EueLargeUploadServiceTest.java b/eue/src/test/java/ch/cyberduck/core/eue/EueLargeUploadServiceTest.java index c0a5992bc81..f9fa82cf625 100644 --- a/eue/src/test/java/ch/cyberduck/core/eue/EueLargeUploadServiceTest.java +++ b/eue/src/test/java/ch/cyberduck/core/eue/EueLargeUploadServiceTest.java @@ -27,6 +27,7 @@ import ch.cyberduck.core.features.Delete; import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -56,7 +57,7 @@ public void testUploadLargeFileInChunks() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); - final EueWriteFeature.Chunk uploadResponse = s.upload(new EueWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback()); + final EueWriteFeature.Chunk uploadResponse = s.upload(new EueWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertNotNull(uploadResponse.getCdash64()); assertEquals(content.length, count.getSent()); assertEquals(PathAttributes.EMPTY, status.getResponse()); diff --git a/eue/src/test/java/ch/cyberduck/core/eue/EueSingleUploadServiceTest.java b/eue/src/test/java/ch/cyberduck/core/eue/EueSingleUploadServiceTest.java index 1736da5c842..dc21673cc91 100644 --- a/eue/src/test/java/ch/cyberduck/core/eue/EueSingleUploadServiceTest.java +++ b/eue/src/test/java/ch/cyberduck/core/eue/EueSingleUploadServiceTest.java @@ -26,6 +26,7 @@ import ch.cyberduck.core.features.Delete; import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -54,7 +55,7 @@ public void testUploadSimpleFile() throws Exception { IOUtils.write(content, local.getOutputStream(false)); final TransferStatus status = new TransferStatus().setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); - service.upload(new EueWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback()); + service.upload(new EueWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); assertTrue(new EueFindFeature(session, fileid).find(file)); @@ -68,7 +69,7 @@ public void testUploadSimpleFile() throws Exception { IOUtils.write(content, local.getOutputStream(false)); final TransferStatus status = new TransferStatus().setLength(content.length).setExists(true); final BytecountStreamListener count = new BytecountStreamListener(); - service.upload(new EueWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback()); + service.upload(new EueWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); assertTrue(new EueFindFeature(session, fileid).find(file)); diff --git a/eue/src/test/java/ch/cyberduck/core/eue/EueThresholdUploadServiceTest.java b/eue/src/test/java/ch/cyberduck/core/eue/EueThresholdUploadServiceTest.java index 26357f821ec..6bd2dac3765 100644 --- a/eue/src/test/java/ch/cyberduck/core/eue/EueThresholdUploadServiceTest.java +++ b/eue/src/test/java/ch/cyberduck/core/eue/EueThresholdUploadServiceTest.java @@ -26,6 +26,7 @@ import ch.cyberduck.core.features.Delete; import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.VaultRegistry; import ch.cyberduck.test.IntegrationTest; @@ -56,7 +57,7 @@ public void testUploadSimpleFile() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); - service.upload(new EueWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback()); + service.upload(new EueWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); assertTrue(new EueFindFeature(session, fileid).find(file)); @@ -82,7 +83,7 @@ public void testUploadLargeFileInChunks() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); - service.upload(new EueWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback()); + service.upload(new EueWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); assertTrue(new EueFindFeature(session, fileid).find(file)); diff --git a/eue/src/test/java/ch/cyberduck/core/eue/EueUploadServiceTest.java b/eue/src/test/java/ch/cyberduck/core/eue/EueUploadServiceTest.java index 64fb6eb21ae..0fbd3f329f3 100644 --- a/eue/src/test/java/ch/cyberduck/core/eue/EueUploadServiceTest.java +++ b/eue/src/test/java/ch/cyberduck/core/eue/EueUploadServiceTest.java @@ -26,6 +26,7 @@ import ch.cyberduck.core.features.Delete; import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -44,7 +45,7 @@ public class EueUploadServiceTest extends AbstractEueSessionTest { @Test public void testUploadLargeFileInChunks() throws Exception { final EueResourceIdProvider fileid = new EueResourceIdProvider(session); - final EueUploadService s = new EueUploadService(session); + final EueUploadService s = new EueUploadService(); final Path container = new EueDirectoryFeature(session, fileid).mkdir(new EueWriteFeature(session, fileid), new Path( new AlphanumericRandomStringService().random(), EnumSet.of(AbstractPath.Type.directory)), new TransferStatus()); final String name = new AlphanumericRandomStringService().random(); @@ -55,7 +56,7 @@ public void testUploadLargeFileInChunks() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); - final EueWriteFeature.Chunk uploadResponse = s.upload(new EueMultipartWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback()); + final EueWriteFeature.Chunk uploadResponse = s.upload(new EueMultipartWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertNotNull(uploadResponse.getCdash64()); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); diff --git a/ftp/src/main/java/ch/cyberduck/core/ftp/FTPSession.java b/ftp/src/main/java/ch/cyberduck/core/ftp/FTPSession.java index fcf6f6e4664..7146a7ecb85 100644 --- a/ftp/src/main/java/ch/cyberduck/core/ftp/FTPSession.java +++ b/ftp/src/main/java/ch/cyberduck/core/ftp/FTPSession.java @@ -295,7 +295,7 @@ public T _getFeature(final Class type) { return (T) read; } if(type == Upload.class) { - return (T) new FTPUploadFeature(this); + return (T) new FTPUploadFeature(); } if(type == Write.class) { return (T) new FTPWriteFeature(this); diff --git a/ftp/src/main/java/ch/cyberduck/core/ftp/FTPUploadFeature.java b/ftp/src/main/java/ch/cyberduck/core/ftp/FTPUploadFeature.java index 9de803f8d50..b070c9a5c68 100644 --- a/ftp/src/main/java/ch/cyberduck/core/ftp/FTPUploadFeature.java +++ b/ftp/src/main/java/ch/cyberduck/core/ftp/FTPUploadFeature.java @@ -16,7 +16,6 @@ */ import ch.cyberduck.core.Path; -import ch.cyberduck.core.Session; import ch.cyberduck.core.exception.BackgroundException; import ch.cyberduck.core.features.Write; import ch.cyberduck.core.shared.DefaultUploadFeature; @@ -24,10 +23,6 @@ public class FTPUploadFeature extends DefaultUploadFeature { - public FTPUploadFeature(final Session session) { - super(session); - } - @Override public Write.Append append(final Path file, final TransferStatus status) throws BackgroundException { return new Write.Append(status.isExists()).withStatus(status); diff --git a/ftp/src/test/java/ch/cyberduck/core/ftp/FTPUploadFeatureTest.java b/ftp/src/test/java/ch/cyberduck/core/ftp/FTPUploadFeatureTest.java index 1fb7a8ceff9..1cf5b05c5c2 100644 --- a/ftp/src/test/java/ch/cyberduck/core/ftp/FTPUploadFeatureTest.java +++ b/ftp/src/test/java/ch/cyberduck/core/ftp/FTPUploadFeatureTest.java @@ -34,7 +34,7 @@ public class FTPUploadFeatureTest extends AbstractFTPTest { public void testAppend() throws Exception { final Path f = new Path(new FTPWorkdirService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); new FTPTouchFeature(session).touch(new FTPWriteFeature(session), f, new TransferStatus()); - assertTrue(new FTPUploadFeature(session).append(f, new TransferStatus().setExists(true).setLength(0L).setRemote(new FTPAttributesFinderFeature(session).find(f))).append); + assertTrue(new FTPUploadFeature().append(f, new TransferStatus().setExists(true).setLength(0L).setRemote(new FTPAttributesFinderFeature(session).find(f))).append); new FTPDeleteFeature(session).delete(Collections.singletonList(f), new DisabledLoginCallback(), new Delete.DisabledCallback()); } } \ No newline at end of file diff --git a/ftp/src/test/java/ch/cyberduck/core/shared/DefaultUploadFeatureTest.java b/ftp/src/test/java/ch/cyberduck/core/shared/DefaultUploadFeatureTest.java index 993de99f1e2..f3fae565efb 100644 --- a/ftp/src/test/java/ch/cyberduck/core/shared/DefaultUploadFeatureTest.java +++ b/ftp/src/test/java/ch/cyberduck/core/shared/DefaultUploadFeatureTest.java @@ -29,6 +29,7 @@ import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -58,17 +59,17 @@ public void testTransferAppend() throws Exception { final Path test = new Path(new DefaultHomeFinderService(session).find(), UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); { final TransferStatus status = new TransferStatus().setLength(content.length / 2); - final Void reply = new DefaultUploadFeature(session).upload( + final Void reply = new DefaultUploadFeature().upload( new FTPWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); } { final TransferStatus status = new TransferStatus().setLength(content.length / 2).setOffset(content.length / 2).setAppend(true); - final Void reply = new DefaultUploadFeature(session).upload( + final Void reply = new DefaultUploadFeature().upload( new FTPWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); } final byte[] buffer = new byte[content.length]; final Read read = session.getFeature(Read.class); diff --git a/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveSession.java b/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveSession.java index 192a61b3f05..9034eb55652 100644 --- a/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveSession.java +++ b/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveSession.java @@ -129,7 +129,7 @@ public T _getFeature(Class type) { return (T) new DriveWriteFeature(this, fileid); } if(type == Upload.class) { - return (T) new DriveUploadFeature(this); + return (T) new DriveUploadFeature(); } if(type == Directory.class) { return (T) new DriveDirectoryFeature(this, fileid); diff --git a/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveUploadFeature.java b/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveUploadFeature.java index 135ab584720..324bec53cf5 100644 --- a/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveUploadFeature.java +++ b/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveUploadFeature.java @@ -17,12 +17,7 @@ import ch.cyberduck.core.http.HttpUploadFeature; -import java.security.MessageDigest; - import com.google.api.services.drive.model.File; -public class DriveUploadFeature extends HttpUploadFeature { - - public DriveUploadFeature(final DriveSession session) { - } +public class DriveUploadFeature extends HttpUploadFeature { } diff --git a/googledrive/src/test/java/ch/cyberduck/core/googledrive/DriveReadFeatureTest.java b/googledrive/src/test/java/ch/cyberduck/core/googledrive/DriveReadFeatureTest.java index e3da6555d56..b1b311e4164 100644 --- a/googledrive/src/test/java/ch/cyberduck/core/googledrive/DriveReadFeatureTest.java +++ b/googledrive/src/test/java/ch/cyberduck/core/googledrive/DriveReadFeatureTest.java @@ -30,6 +30,7 @@ import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.io.StreamCopier; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -76,10 +77,10 @@ public void testReadRange() throws Exception { IOUtils.write(content, out); out.close(); final DriveFileIdProvider fileid = new DriveFileIdProvider(session); - new DriveUploadFeature(session).upload( + new DriveUploadFeature().upload( new DriveWriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); diff --git a/googledrive/src/test/java/ch/cyberduck/core/googledrive/DriveUploadFeatureTest.java b/googledrive/src/test/java/ch/cyberduck/core/googledrive/DriveUploadFeatureTest.java index 93e6e489740..88f38c777e2 100644 --- a/googledrive/src/test/java/ch/cyberduck/core/googledrive/DriveUploadFeatureTest.java +++ b/googledrive/src/test/java/ch/cyberduck/core/googledrive/DriveUploadFeatureTest.java @@ -27,6 +27,7 @@ import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -56,9 +57,9 @@ public void testWrite() throws Exception { status.setLength(content.length); final Path test = new Path(DriveHomeFinderService.MYDRIVE_FOLDER, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); final DriveFileIdProvider fileid = new DriveFileIdProvider(session); - final DriveUploadFeature upload = new DriveUploadFeature(session); + final DriveUploadFeature upload = new DriveUploadFeature(); upload.upload(new DriveWriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), - status, new DisabledConnectionCallback()); + status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); test.attributes().setFileId(fileid.getFileId(test)); assertTrue(session.getFeature(Find.class).find(test)); assertEquals(content.length, new DriveListService(session, fileid).list(test.getParent(), new DisabledListProgressListener()).get(test).attributes().getSize(), 0L); diff --git a/googlestorage/src/test/java/ch/cyberduck/core/googlestorage/DefaultUploadFeatureTest.java b/googlestorage/src/test/java/ch/cyberduck/core/googlestorage/DefaultUploadFeatureTest.java index 87b92ff0d04..61fcccdc8a9 100644 --- a/googlestorage/src/test/java/ch/cyberduck/core/googlestorage/DefaultUploadFeatureTest.java +++ b/googlestorage/src/test/java/ch/cyberduck/core/googlestorage/DefaultUploadFeatureTest.java @@ -28,6 +28,7 @@ import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.shared.DefaultUploadFeature; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -50,7 +51,7 @@ public class DefaultUploadFeatureTest extends AbstractGoogleStorageTest { @Test public void testUpload() throws Exception { - final DefaultUploadFeature m = new DefaultUploadFeature<>(session); + final DefaultUploadFeature m = new DefaultUploadFeature<>(); final Path container = new Path("cyberduck-test-eu", EnumSet.of(Path.Type.directory, Path.Type.volume)); final Path test = new Path(container, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); final Local local = new Local(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString()); @@ -61,7 +62,7 @@ public void testUpload() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(random.length); final StorageObject versionId = m.upload(new GoogleStorageWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertTrue(new GoogleStorageFindFeature(session).find(test)); final PathAttributes attributes = new GoogleStorageListService(session).list(container, new DisabledListProgressListener()).find(new SimplePathPredicate(test)).attributes(); assertEquals(random.length, attributes.getSize()); diff --git a/irods/src/main/java/ch/cyberduck/core/irods/IRODSUploadFeature.java b/irods/src/main/java/ch/cyberduck/core/irods/IRODSUploadFeature.java index 93f4b591879..de3c94ca575 100644 --- a/irods/src/main/java/ch/cyberduck/core/irods/IRODSUploadFeature.java +++ b/irods/src/main/java/ch/cyberduck/core/irods/IRODSUploadFeature.java @@ -35,6 +35,8 @@ import ch.cyberduck.core.preferences.PreferencesFactory; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; + import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -63,7 +65,7 @@ public IRODSUploadFeature(final IRODSSession session) { @Override public Void upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, - final ConnectionCallback callback) throws BackgroundException { + final ConnectionCallback callback, final UploadFilterOptions uploadFilterOptions) throws BackgroundException { try { final IRODSFileSystemAO fs = session.getClient(); final IRODSFile f = fs.getIRODSFileFactory().instanceIRODSFile(file.getAbsolute()); @@ -98,7 +100,7 @@ public Void upload(final Write write, final Path file, final Local local, final Checksum expected = ChecksumComputeFactory.get(fingerprint.algorithm).compute(local.getInputStream(), new TransferStatus(status)); if(!expected.equals(fingerprint)) { throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()), - MessageFormat.format("Mismatch between {0} hash {1} of uploaded data and ETag {2} returned by the server", + MessageFormat.format("Mismatch between {0} hash {1} of transfered data and {2} returned by the server", fingerprint.algorithm.toString(), expected, fingerprint.hash)); } } diff --git a/irods/src/test/java/ch/cyberduck/core/irods/IRODSReadFeatureTest.java b/irods/src/test/java/ch/cyberduck/core/irods/IRODSReadFeatureTest.java index e77c9083589..7d887d81c14 100644 --- a/irods/src/test/java/ch/cyberduck/core/irods/IRODSReadFeatureTest.java +++ b/irods/src/test/java/ch/cyberduck/core/irods/IRODSReadFeatureTest.java @@ -38,6 +38,7 @@ import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader; import ch.cyberduck.core.shared.DefaultUploadFeature; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import ch.cyberduck.test.VaultTest; @@ -136,10 +137,10 @@ public void testReadRange() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DefaultUploadFeature(session).upload( + new DefaultUploadFeature().upload( new IRODSWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); diff --git a/irods/src/test/java/ch/cyberduck/core/irods/IRODSUploadFeatureTest.java b/irods/src/test/java/ch/cyberduck/core/irods/IRODSUploadFeatureTest.java index 947a3ac28e5..0c80fc2770f 100644 --- a/irods/src/test/java/ch/cyberduck/core/irods/IRODSUploadFeatureTest.java +++ b/irods/src/test/java/ch/cyberduck/core/irods/IRODSUploadFeatureTest.java @@ -36,6 +36,7 @@ import ch.cyberduck.core.proxy.DisabledProxyFinder; import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import ch.cyberduck.test.VaultTest; @@ -83,7 +84,7 @@ public void testAppend() throws Exception { new IRODSUploadFeature(session).upload( new IRODSWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length / 2, count.getSent()); } { @@ -91,7 +92,7 @@ public void testAppend() throws Exception { new IRODSUploadFeature(session).upload( new IRODSWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length / 2, status.getOffset()); } final byte[] buffer = new byte[content.length]; @@ -126,7 +127,7 @@ public void testWrite() throws Exception { final TransferStatus status = new TransferStatus().setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); new IRODSUploadFeature(session).upload( - new IRODSWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback()); + new IRODSWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertTrue(status.isComplete()); assertEquals(content.length, count.getSent()); final byte[] buffer = new byte[content.length]; @@ -167,7 +168,7 @@ public void sent(final long bytes) { } }, status, - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); try { status.validate(); fail(); diff --git a/manta/src/test/java/ch/cyberduck/core/manta/MantaReadFeatureTest.java b/manta/src/test/java/ch/cyberduck/core/manta/MantaReadFeatureTest.java index 75794fc4aa2..751556eadc7 100644 --- a/manta/src/test/java/ch/cyberduck/core/manta/MantaReadFeatureTest.java +++ b/manta/src/test/java/ch/cyberduck/core/manta/MantaReadFeatureTest.java @@ -28,6 +28,7 @@ import ch.cyberduck.core.io.StreamCopier; import ch.cyberduck.core.shared.DefaultUploadFeature; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -97,13 +98,13 @@ public void testReadRange() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DefaultUploadFeature(session).upload( + new DefaultUploadFeature().upload( new MantaWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); @@ -133,10 +134,10 @@ public void testReadRangeUnknownLength() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DefaultUploadFeature(session).upload( + new DefaultUploadFeature().upload( new MantaWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final TransferStatus status = new TransferStatus(); status.setLength(-1L); status.setAppend(true); diff --git a/nio/src/main/java/ch/cyberduck/core/nio/LocalSession.java b/nio/src/main/java/ch/cyberduck/core/nio/LocalSession.java index c7db0dbf0b0..64f3db5891a 100644 --- a/nio/src/main/java/ch/cyberduck/core/nio/LocalSession.java +++ b/nio/src/main/java/ch/cyberduck/core/nio/LocalSession.java @@ -172,7 +172,7 @@ public T _getFeature(final Class type) { return (T) new LocalTimestampFeature(this); } if(type == Upload.class) { - return (T) new LocalUploadFeature(this); + return (T) new LocalUploadFeature(); } return super._getFeature(type); } diff --git a/nio/src/main/java/ch/cyberduck/core/nio/LocalUploadFeature.java b/nio/src/main/java/ch/cyberduck/core/nio/LocalUploadFeature.java index 94193a98335..74a278e6744 100644 --- a/nio/src/main/java/ch/cyberduck/core/nio/LocalUploadFeature.java +++ b/nio/src/main/java/ch/cyberduck/core/nio/LocalUploadFeature.java @@ -16,7 +16,6 @@ */ import ch.cyberduck.core.Path; -import ch.cyberduck.core.Session; import ch.cyberduck.core.exception.BackgroundException; import ch.cyberduck.core.features.Write; import ch.cyberduck.core.shared.DefaultUploadFeature; @@ -24,10 +23,6 @@ public class LocalUploadFeature extends DefaultUploadFeature { - public LocalUploadFeature(final Session session) { - super(session); - } - @Override public Write.Append append(final Path file, final TransferStatus status) throws BackgroundException { return new Write.Append(status.isExists()).withStatus(status); diff --git a/nio/src/test/java/ch/cyberduck/core/nio/LocalUploadFeatureTest.java b/nio/src/test/java/ch/cyberduck/core/nio/LocalUploadFeatureTest.java index 66d1099421f..e1bd50e92ec 100644 --- a/nio/src/test/java/ch/cyberduck/core/nio/LocalUploadFeatureTest.java +++ b/nio/src/test/java/ch/cyberduck/core/nio/LocalUploadFeatureTest.java @@ -42,7 +42,7 @@ public void testAppend() throws Exception { final Path workdir = new LocalHomeFinderFeature().find(); final Path test = new Path(workdir, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); new LocalTouchFeature(session).touch(new LocalWriteFeature(session), test, new TransferStatus()); - assertTrue(new LocalUploadFeature(session).append(test, new TransferStatus().setExists(true).setLength(0L).setRemote(new LocalAttributesFinderFeature(session).find(test))).append); + assertTrue(new LocalUploadFeature().append(test, new TransferStatus().setExists(true).setLength(0L).setRemote(new LocalAttributesFinderFeature(session).find(test))).append); new LocalDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); } } \ No newline at end of file diff --git a/onedrive/src/test/java/ch/cyberduck/core/onedrive/GraphReadFeatureTest.java b/onedrive/src/test/java/ch/cyberduck/core/onedrive/GraphReadFeatureTest.java index 24953e9bc70..7e36bff8ee0 100644 --- a/onedrive/src/test/java/ch/cyberduck/core/onedrive/GraphReadFeatureTest.java +++ b/onedrive/src/test/java/ch/cyberduck/core/onedrive/GraphReadFeatureTest.java @@ -32,6 +32,7 @@ import ch.cyberduck.core.onedrive.features.GraphWriteFeature; import ch.cyberduck.core.shared.DefaultUploadFeature; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -91,10 +92,10 @@ public void testReadRange() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DefaultUploadFeature(session).upload( + new DefaultUploadFeature().upload( new GraphWriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); @@ -134,10 +135,10 @@ public void testReadRangeUnknownLength() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DefaultUploadFeature(session).upload( + new DefaultUploadFeature().upload( new GraphWriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final TransferStatus status = new TransferStatus(); status.setLength(-1L); status.setAppend(true); diff --git a/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftLargeObjectUploadFeature.java b/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftLargeObjectUploadFeature.java index 2cf863d2947..88b368702c9 100644 --- a/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftLargeObjectUploadFeature.java +++ b/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftLargeObjectUploadFeature.java @@ -45,11 +45,12 @@ import ch.cyberduck.core.transfer.SegmentRetryCallable; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.io.IOException; -import java.security.MessageDigest; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collections; @@ -59,7 +60,7 @@ import ch.iterate.openstack.swift.exception.GenericException; import ch.iterate.openstack.swift.model.StorageObject; -public class SwiftLargeObjectUploadFeature extends HttpUploadFeature { +public class SwiftLargeObjectUploadFeature extends HttpUploadFeature { private static final Logger log = LogManager.getLogger(SwiftLargeObjectUploadFeature.class); private final SwiftSession session; @@ -99,7 +100,7 @@ public StorageObject upload(final Write write, final Path file, f final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, - final ConnectionCallback callback) throws BackgroundException { + final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { final ThreadPool pool = ThreadPoolFactory.get("multipart", concurrency); final List existingSegments = new ArrayList<>(); if(status.isAppend()) { @@ -146,7 +147,7 @@ public StorageObject upload(final Write write, final Path file, f } else { // Submit to queue - segments.add(this.submit(pool, write, segment, local, throttle, streamListener, status, offset, length, callback)); + segments.add(this.submit(pool, write, segment, local, throttle, streamListener, status, offset, length, callback, options)); log.debug("Segment {} submitted with size {} and offset {}", segment, length, offset); remaining -= length; offset += length; @@ -191,7 +192,7 @@ public StorageObject upload(final Write write, final Path file, f private Future submit(final ThreadPool pool, final Write write, final Path segment, final Local local, final BandwidthThrottle throttle, final StreamListener listener, - final TransferStatus overall, final Long offset, final Long length, final ConnectionCallback callback) throws ConnectionCanceledException { + final TransferStatus overall, final Long offset, final Long length, final ConnectionCallback callback, final UploadFilterOptions options) throws ConnectionCanceledException { overall.validate(); log.info("Submit part {} to queue with offset {} and length {}", segment, offset, length); final BytecountStreamListener counter = new BytecountStreamListener(listener); @@ -205,8 +206,8 @@ public StorageObject call() throws BackgroundException { status.setHeader(overall.getHeader()); status.setChecksum(write.checksum(segment, status).compute(local.getInputStream(), status)); status.setSegment(true); - return SwiftLargeObjectUploadFeature.this.upload( - write, segment, local, throttle, counter, status, overall, status, callback); + return SwiftLargeObjectUploadFeature.this.transfer( + write, segment, local, throttle, counter, status, overall, status, callback, options); } }, overall, counter)); } diff --git a/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftSmallObjectUploadFeature.java b/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftSmallObjectUploadFeature.java index 11616da0e1c..71dd89dc10a 100644 --- a/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftSmallObjectUploadFeature.java +++ b/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftSmallObjectUploadFeature.java @@ -17,59 +17,23 @@ * Bug fixes, suggestions and comments should be sent to feedback@cyberduck.ch */ -import ch.cyberduck.core.Path; -import ch.cyberduck.core.exception.BackgroundException; import ch.cyberduck.core.http.HttpUploadFeature; -import ch.cyberduck.core.io.Checksum; -import ch.cyberduck.core.preferences.HostPreferencesFactory; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import java.io.IOException; -import java.io.InputStream; -import java.security.DigestInputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import ch.iterate.openstack.swift.model.StorageObject; -public class SwiftSmallObjectUploadFeature extends HttpUploadFeature { - private static final Logger log = LogManager.getLogger(SwiftSmallObjectUploadFeature.class); - - private final SwiftSession session; - - public SwiftSmallObjectUploadFeature(final SwiftSession session) { - this.session = session; - } - - @Override - protected InputStream decorate(final InputStream in, final MessageDigest digest) throws IOException { - if(null == digest) { - log.warn("MD5 calculation disabled"); - return super.decorate(in, null); - } - else { - return new DigestInputStream(in, digest); - } - } +public class SwiftSmallObjectUploadFeature extends HttpUploadFeature { @Override protected MessageDigest digest() throws IOException { - MessageDigest digest = null; - if(HostPreferencesFactory.get(session.getHost()).getBoolean("queue.upload.checksum.calculate")) { - try { - digest = MessageDigest.getInstance("MD5"); - } - catch(NoSuchAlgorithmException e) { - throw new IOException(e.getMessage(), e); - } + try { + return MessageDigest.getInstance("MD5"); + } + catch(NoSuchAlgorithmException e) { + throw new IOException(e.getMessage(), e); } - return digest; - } - - @Override - protected void post(final Path file, final MessageDigest digest, final StorageObject response) throws BackgroundException { - this.verify(file, digest, Checksum.parse(response.getMd5sum())); } } diff --git a/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftThresholdUploadService.java b/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftThresholdUploadService.java index 083867b1bc4..6194487308b 100644 --- a/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftThresholdUploadService.java +++ b/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftThresholdUploadService.java @@ -29,6 +29,8 @@ import ch.cyberduck.core.preferences.HostPreferencesFactory; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -63,15 +65,15 @@ public Write.Append append(final Path file, final TransferStatus status) throws @Override public StorageObject upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { + final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { final Upload feature; if(this.threshold(status)) { feature = new SwiftLargeObjectUploadFeature(session, regionService); } else { - feature = new SwiftSmallObjectUploadFeature(session); + feature = new SwiftSmallObjectUploadFeature(); } - return feature.upload(write, file, local, throttle, progress, streamListener, status, callback); + return feature.upload(write, file, local, throttle, progress, streamListener, status, callback, options); } protected boolean threshold(final TransferStatus status) { diff --git a/openstack/src/test/java/ch/cyberduck/core/cryptomator/SwiftLargeObjectUploadFeatureTest.java b/openstack/src/test/java/ch/cyberduck/core/cryptomator/SwiftLargeObjectUploadFeatureTest.java index 3044112839d..476c532fa9f 100644 --- a/openstack/src/test/java/ch/cyberduck/core/cryptomator/SwiftLargeObjectUploadFeatureTest.java +++ b/openstack/src/test/java/ch/cyberduck/core/cryptomator/SwiftLargeObjectUploadFeatureTest.java @@ -41,6 +41,7 @@ import ch.cyberduck.core.openstack.SwiftRegionService; import ch.cyberduck.core.openstack.SwiftWriteFeature; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.DefaultVaultRegistry; import ch.cyberduck.core.vault.VaultCredentials; import ch.cyberduck.test.IntegrationTest; @@ -89,7 +90,8 @@ public void testLargeObjectUpload() throws Exception { writeStatus.setHeader(cryptomator.getFileHeaderCryptor().encryptHeader(header)); writeStatus.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); - service.upload(new CryptoWriteFeature<>(session, new SwiftWriteFeature(session, new SwiftRegionService(session)), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, null); + service.upload(new CryptoWriteFeature<>(session, new SwiftWriteFeature(session, new SwiftRegionService(session)), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, null, + new UploadFilterOptions(session.getHost())); assertEquals(content.length, count.getSent()); assertTrue(writeStatus.isComplete()); assertEquals(content.length, writeStatus.getResponse().getSize()); diff --git a/openstack/src/test/java/ch/cyberduck/core/openstack/SwiftLargeObjectUploadFeatureTest.java b/openstack/src/test/java/ch/cyberduck/core/openstack/SwiftLargeObjectUploadFeatureTest.java index 0f87d29da9d..40df925005e 100644 --- a/openstack/src/test/java/ch/cyberduck/core/openstack/SwiftLargeObjectUploadFeatureTest.java +++ b/openstack/src/test/java/ch/cyberduck/core/openstack/SwiftLargeObjectUploadFeatureTest.java @@ -23,6 +23,7 @@ import ch.cyberduck.core.io.StreamProgress; import ch.cyberduck.core.shared.DefaultAttributesFinderFeature; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -76,7 +77,7 @@ protected void beforeRead(int n) throws IOException { } }; } - }, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), listener, status, new DisabledLoginCallback()); + }, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), listener, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); } catch(BackgroundException e) { // Expected @@ -91,7 +92,7 @@ protected void beforeRead(int n) throws IOException { new SwiftLargeObjectUploadFeature(session, new SwiftRegionService(session), 1 * 1024L * 1024L, 1).upload(new SwiftWriteFeature(session, new SwiftRegionService(session)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), append, - new DisabledLoginCallback()); + new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length, append.getResponse().getSize()); assertTrue(new SwiftFindFeature(session).find(test)); assertEquals(content.length, new SwiftAttributesFinderFeature(session).find(test).getSize()); @@ -123,19 +124,19 @@ public void testAppendSecondPart() throws Exception { final SwiftLargeObjectUploadFeature feature = new SwiftLargeObjectUploadFeature(session, regionService, 1024L * 1024L, 1) { @Override - public StorageObject upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final StreamCancelation cancel, final StreamProgress progress, final ConnectionCallback callback) throws BackgroundException { + public StorageObject transfer(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final StreamCancelation cancel, final StreamProgress progress, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { if(!interrupt.get()) { if(status.getOffset() >= 1L * 1024L * 1024L) { throw new ConnectionTimeoutException("Test"); } } - return super.upload(write, file, local, throttle, listener, status, cancel, progress, callback); + return super.transfer(write, file, local, throttle, listener, status, cancel, progress, callback, options); } }; final BytecountStreamListener listener = new BytecountStreamListener(); try { feature.upload(new SwiftWriteFeature(session, new SwiftRegionService(session)), test, new Local(System.getProperty("java.io.tmpdir"), name), - new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), listener, status, new DisabledLoginCallback()); + new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), listener, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); } catch(BackgroundException e) { // Expected @@ -152,7 +153,7 @@ public StorageObject upload(final Write write, final Path file, f final TransferStatus append = new TransferStatus().setAppend(true).setLength(1024L * 1024L).setOffset(1024L * 1024L); feature.upload(new SwiftWriteFeature(session, new SwiftRegionService(session)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), listener, append, - new DisabledLoginCallback()); + new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertEquals(2 * 1024L * 1024L, listener.getSent()); assertTrue(append.isComplete()); assertNotSame(PathAttributes.EMPTY, append.getResponse()); @@ -197,7 +198,7 @@ public void testUploadOverwrite() throws Exception { final BytecountStreamListener count = new BytecountStreamListener(); final StorageObject object = upload.upload(new SwiftWriteFeature(session, new SwiftRegionService(session)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, - status, new DisabledConnectionCallback()); + status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertEquals(Checksum.NONE, Checksum.parse(object.getMd5sum())); assertNotEquals(Checksum.NONE, new SwiftAttributesFinderFeature(session).find(test).getChecksum()); assertNotNull(new DefaultAttributesFinderFeature(session).find(test).getChecksum().hash); @@ -250,7 +251,7 @@ public void testUploadOverwrite() throws Exception { final BytecountStreamListener count = new BytecountStreamListener(); upload.upload(new SwiftWriteFeature(session, regionService), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, - status, new DisabledConnectionCallback()); + status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertTrue(status.isComplete()); assertEquals(content.length, status.getResponse().getSize()); diff --git a/openstack/src/test/java/ch/cyberduck/core/openstack/SwiftSmallObjectUploadFeatureTest.java b/openstack/src/test/java/ch/cyberduck/core/openstack/SwiftSmallObjectUploadFeatureTest.java deleted file mode 100644 index 5cc86a01a9d..00000000000 --- a/openstack/src/test/java/ch/cyberduck/core/openstack/SwiftSmallObjectUploadFeatureTest.java +++ /dev/null @@ -1,69 +0,0 @@ -package ch.cyberduck.core.openstack; - -/* - * Copyright (c) 2002-2013 David Kocher. All rights reserved. - * http://cyberduck.ch/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Bug fixes, suggestions and comments should be sent to feedback@cyberduck.ch - */ - -import ch.cyberduck.core.Path; -import ch.cyberduck.core.exception.ChecksumException; -import ch.cyberduck.test.IntegrationTest; - -import org.apache.commons.io.input.NullInputStream; -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import java.security.MessageDigest; -import java.util.EnumSet; - -import ch.iterate.openstack.swift.model.StorageObject; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertSame; - -@Category(IntegrationTest.class) -public class SwiftSmallObjectUploadFeatureTest extends AbstractSwiftTest { - - @Test - public void testDecorate() throws Exception { - final NullInputStream n = new NullInputStream(1L); - assertSame(NullInputStream.class, new SwiftSmallObjectUploadFeature(session).decorate(n, null).getClass()); - } - - @Test(expected = ChecksumException.class) - public void testPostChecksumFailure() throws Exception { - final StorageObject o = new StorageObject("f"); - o.setMd5sum("d41d8cd98f00b204e9800998ecf8427f"); - try { - new SwiftSmallObjectUploadFeature(session).post( - new Path("/f", EnumSet.of(Path.Type.file)), MessageDigest.getInstance("MD5"), o - ); - } - catch(ChecksumException e) { - assertEquals("Upload f failed", e.getMessage()); - assertEquals("Mismatch between MD5 hash d41d8cd98f00b204e9800998ecf8427e of uploaded data and ETag d41d8cd98f00b204e9800998ecf8427f returned by the server.", e.getDetail()); - throw e; - } - } - - @Test - public void testPostChecksum() throws Exception { - final StorageObject o = new StorageObject("f"); - o.setMd5sum("d41d8cd98f00b204e9800998ecf8427e"); - new SwiftSmallObjectUploadFeature(session).post( - new Path("/f", EnumSet.of(Path.Type.file)), MessageDigest.getInstance("MD5"), o - ); - } -} diff --git a/openstack/src/test/java/ch/cyberduck/core/worker/SwiftSingleTransferWorkerTest.java b/openstack/src/test/java/ch/cyberduck/core/worker/SwiftSingleTransferWorkerTest.java index f7d6709ed4a..f277b76a6d9 100644 --- a/openstack/src/test/java/ch/cyberduck/core/worker/SwiftSingleTransferWorkerTest.java +++ b/openstack/src/test/java/ch/cyberduck/core/worker/SwiftSingleTransferWorkerTest.java @@ -46,6 +46,7 @@ import ch.cyberduck.core.transfer.TransferOptions; import ch.cyberduck.core.transfer.TransferSpeedometer; import ch.cyberduck.core.transfer.UploadTransfer; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import ch.cyberduck.test.VaultTest; @@ -58,7 +59,6 @@ import java.io.InputStream; import java.io.OutputStream; import java.net.SocketTimeoutException; -import java.security.MessageDigest; import java.util.Collections; import java.util.EnumSet; import java.util.Random; @@ -101,7 +101,7 @@ public T _getFeature(final Class type) { final SwiftRegionService regionService = new SwiftRegionService(this); return (T) new SwiftLargeObjectUploadFeature(this, regionService, 1024L * 1024L, 5) { @Override - protected InputStream decorate(final InputStream in, final MessageDigest digest) { + protected InputStream decorate(final InputStream in, final UploadFilterOptions options) { if(failed.get()) { // Second attempt successful return in; diff --git a/owncloud/src/test/java/ch/cyberduck/core/cryptomator/OcisUploadFeatureTest.java b/owncloud/src/test/java/ch/cyberduck/core/cryptomator/OcisUploadFeatureTest.java index 8d697d3e176..9a9091ae72a 100644 --- a/owncloud/src/test/java/ch/cyberduck/core/cryptomator/OcisUploadFeatureTest.java +++ b/owncloud/src/test/java/ch/cyberduck/core/cryptomator/OcisUploadFeatureTest.java @@ -42,6 +42,7 @@ import ch.cyberduck.core.owncloud.OwncloudAttributesFinderFeature; import ch.cyberduck.core.owncloud.OwncloudHomeFeature; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.tus.TusCapabilities; import ch.cyberduck.core.tus.TusWriteFeature; import ch.cyberduck.core.vault.DefaultVaultRegistry; @@ -93,7 +94,7 @@ public void testUploadVault() throws Exception { writeStatus.setLength(content.length); final Path test = new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); final BytecountStreamListener counter = new BytecountStreamListener(); - service.upload(new TusWriteFeature(capabilities, session.getClient()), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), counter, writeStatus, new DisabledConnectionCallback()); + service.upload(new TusWriteFeature(capabilities, session.getClient()), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), counter, writeStatus, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertEquals(content.length, counter.getSent()); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new DAVFindFeature(session)).find(test)); diff --git a/owncloud/src/test/java/ch/cyberduck/core/owncloud/OcisUploadFeatureTest.java b/owncloud/src/test/java/ch/cyberduck/core/owncloud/OcisUploadFeatureTest.java index 9c4b222e95b..78360d11f65 100644 --- a/owncloud/src/test/java/ch/cyberduck/core/owncloud/OcisUploadFeatureTest.java +++ b/owncloud/src/test/java/ch/cyberduck/core/owncloud/OcisUploadFeatureTest.java @@ -35,6 +35,7 @@ import ch.cyberduck.core.io.SHA1ChecksumCompute; import ch.cyberduck.core.nextcloud.NextcloudWriteFeature; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.tus.TusCapabilities; import ch.cyberduck.core.tus.TusWriteFeature; import ch.cyberduck.test.IntegrationTest; @@ -74,7 +75,7 @@ public void testUploadLargeFileInChunks() throws Exception { status.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); assertFalse(feature.append(file, status).append); - final Void response = feature.upload(new TusWriteFeature(capabilities, session.getClient()), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback()); + final Void response = feature.upload(new TusWriteFeature(capabilities, session.getClient()), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertTrue(status.isComplete()); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); @@ -96,7 +97,7 @@ public void testUploadLargeFileInChunks() throws Exception { status.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); assertFalse(feature.append(file, status).append); - final Void response = feature.upload(new TusWriteFeature(capabilities, session.getClient()), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback()); + final Void response = feature.upload(new TusWriteFeature(capabilities, session.getClient()), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertTrue(status.isComplete()); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); diff --git a/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartUploadService.java b/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartUploadService.java index 8c8021a647c..659ec2c8c61 100644 --- a/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartUploadService.java +++ b/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartUploadService.java @@ -44,6 +44,8 @@ import ch.cyberduck.core.transfer.SegmentRetryCallable; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; + import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpHeaders; import org.apache.logging.log4j.LogManager; @@ -55,7 +57,6 @@ import org.jets3t.service.model.S3Object; import org.jets3t.service.model.StorageObject; -import java.security.MessageDigest; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Date; @@ -66,7 +67,7 @@ import java.util.Set; import java.util.concurrent.Future; -public class S3MultipartUploadService extends HttpUploadFeature { +public class S3MultipartUploadService extends HttpUploadFeature { private static final Logger log = LogManager.getLogger(S3MultipartUploadService.class); private final S3Session session; @@ -96,7 +97,7 @@ public S3MultipartUploadService(final S3Session session, final S3AccessControlLi @Override public StorageObject upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { + final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { final ThreadPool pool = ThreadPoolFactory.get("multipart", concurrency); try { MultipartUpload multipart = null; @@ -152,7 +153,7 @@ public StorageObject upload(final Write write, final Path file, f // Last part can be less than 5 MB. Adjust part size. final long length = Math.min(Math.max((size / (S3DefaultMultipartService.MAXIMUM_UPLOAD_PARTS - 1)), partsize), remaining); // Submit to queue - parts.add(this.submit(pool, write, file, local, throttle, streamListener, status, multipart, partNumber, offset, length, callback)); + parts.add(this.submit(pool, write, file, local, throttle, streamListener, status, multipart, partNumber, offset, length, callback, options)); remaining -= length; offset += length; } @@ -181,7 +182,7 @@ public StorageObject upload(final Write write, final Path file, f final String reference = StringUtils.remove(complete.getEtag(), "\""); if(!StringUtils.equalsIgnoreCase(expected, reference)) { throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()), - MessageFormat.format("Mismatch between MD5 hash {0} of uploaded data and ETag {1} returned by the server", + MessageFormat.format("Mismatch between {2} checksum {0} of transfered data and {1} returned by the server", expected, reference)); } } @@ -209,7 +210,7 @@ public StorageObject upload(final Write write, final Path file, f private Future submit(final ThreadPool pool, final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus overall, final MultipartUpload multipart, - final int partNumber, final long offset, final long length, final ConnectionCallback callback) throws ConnectionCanceledException { + final int partNumber, final long offset, final long length, final ConnectionCallback callback, final UploadFilterOptions options) throws ConnectionCanceledException { overall.validate(); log.info("Submit part {} of {} to queue with offset {} and length {}", partNumber, file, offset, length); final BytecountStreamListener counter = new BytecountStreamListener(listener); @@ -239,8 +240,8 @@ public MultipartPart call() throws BackgroundException { metadata.put(HttpHeaders.CONTENT_MD5, md5.get().base64); status.setMetadata(metadata); } - final StorageObject part = S3MultipartUploadService.this.upload( - write, file, local, throttle, counter, status, overall, status, callback); + final StorageObject part = S3MultipartUploadService.this.transfer( + write, file, local, throttle, counter, status, overall, status, callback, options); log.info("Received response {} for part number {}", part, partNumber); // Populate part with response data that is accessible via the object's metadata return new MultipartPart(partNumber, diff --git a/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartWriteFeature.java b/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartWriteFeature.java index d1b1b92462f..14a8e433394 100644 --- a/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartWriteFeature.java +++ b/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartWriteFeature.java @@ -208,7 +208,7 @@ public void close() throws IOException { final String reference = StringUtils.remove(complete.getEtag(), "\""); if(!StringUtils.equalsIgnoreCase(expected, reference)) { throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()), - MessageFormat.format("Mismatch between MD5 hash {0} of uploaded data and ETag {1} returned by the server", + MessageFormat.format("Mismatch between {2} checksum {0} of transfered data and {1} returned by the server", expected, reference)); } } diff --git a/s3/src/main/java/ch/cyberduck/core/s3/S3SingleUploadService.java b/s3/src/main/java/ch/cyberduck/core/s3/S3SingleUploadService.java index 29bf4900e22..53b2e7a7ad3 100644 --- a/s3/src/main/java/ch/cyberduck/core/s3/S3SingleUploadService.java +++ b/s3/src/main/java/ch/cyberduck/core/s3/S3SingleUploadService.java @@ -29,20 +29,19 @@ import ch.cyberduck.core.io.Checksum; import ch.cyberduck.core.io.HashAlgorithm; import ch.cyberduck.core.io.StreamListener; -import ch.cyberduck.core.preferences.HostPreferencesFactory; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.jets3t.service.model.StorageObject; import java.io.IOException; -import java.io.InputStream; -import java.security.DigestInputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -public class S3SingleUploadService extends HttpUploadFeature { +public class S3SingleUploadService extends HttpUploadFeature { private static final Logger log = LogManager.getLogger(S3SingleUploadService.class); private final S3Session session; @@ -53,7 +52,7 @@ public S3SingleUploadService(final S3Session session) { @Override public StorageObject upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, - final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { + final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { final S3Protocol.AuthenticationHeaderSignatureVersion signatureVersion = session.getSignatureVersion(); switch(signatureVersion) { case AWS4HMACSHA256: @@ -64,49 +63,30 @@ public StorageObject upload(final Write write, final Path file, f break; } try { - return super.upload(write, file, local, throttle, progress, streamListener, status, callback); + final StorageObject response = super.upload(write, file, local, throttle, progress, streamListener, status, callback, options); + if(null != response.getServerSideEncryptionAlgorithm()) { + log.warn("Skip checksum verification for {} with server side encryption enabled", file); + status.setChecksum(Checksum.NONE); + } + return response; } catch(InteroperabilityException e) { if(!session.getSignatureVersion().equals(signatureVersion)) { // Retry if upload fails with Header "x-amz-content-sha256" set to the hex-encoded SHA256 hash of the // request payload is required for AWS Version 4 request signing - return this.upload(write, file, local, throttle, progress, streamListener, status, callback); + return this.upload(write, file, local, throttle, progress, streamListener, status, callback, options); } throw e; } } - @Override - protected InputStream decorate(final InputStream in, final MessageDigest digest) throws IOException { - if(null == digest) { - log.warn("MD5 calculation disabled"); - return super.decorate(in, null); - } - else { - return new DigestInputStream(in, digest); - } - } - @Override protected MessageDigest digest() throws IOException { - MessageDigest digest = null; - if(HostPreferencesFactory.get(session.getHost()).getBoolean("queue.upload.checksum.calculate")) { - try { - digest = MessageDigest.getInstance("MD5"); - } - catch(NoSuchAlgorithmException e) { - throw new IOException(e.getMessage(), e); - } + try { + return MessageDigest.getInstance("MD5"); } - return digest; - } - - @Override - protected void post(final Path file, final MessageDigest digest, final StorageObject response) throws BackgroundException { - if(null != response.getServerSideEncryptionAlgorithm()) { - log.warn("Skip checksum verification for {} with server side encryption enabled", file); - return; + catch(NoSuchAlgorithmException e) { + throw new IOException(e.getMessage(), e); } - this.verify(file, digest, Checksum.parse(response.getETag())); } } diff --git a/s3/src/main/java/ch/cyberduck/core/s3/S3ThresholdUploadService.java b/s3/src/main/java/ch/cyberduck/core/s3/S3ThresholdUploadService.java index e1026a1073d..c1bfbee7211 100644 --- a/s3/src/main/java/ch/cyberduck/core/s3/S3ThresholdUploadService.java +++ b/s3/src/main/java/ch/cyberduck/core/s3/S3ThresholdUploadService.java @@ -32,6 +32,8 @@ import ch.cyberduck.core.preferences.HostPreferencesFactory; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.jets3t.service.model.StorageObject; @@ -63,16 +65,16 @@ public Write.Append append(final Path file, final TransferStatus status) throws @Override public StorageObject upload(final Write write, final Path file, Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback prompt) throws BackgroundException { + final TransferStatus status, final ConnectionCallback prompt, final UploadFilterOptions options) throws BackgroundException { if(this.threshold(status)) { try { - return new S3MultipartUploadService(session, acl).upload(write, file, local, throttle, progress, streamListener, status, prompt); + return new S3MultipartUploadService(session, acl).upload(write, file, local, throttle, progress, streamListener, status, prompt, options); } catch(NotfoundException | InteroperabilityException e) { log.warn("Failure {} using multipart upload. Fallback to single upload.", e.getMessage()); status.setAppend(false); try { - return new S3SingleUploadService(session).upload(write, file, local, throttle, progress, streamListener, status, prompt); + return new S3SingleUploadService(session).upload(write, file, local, throttle, progress, streamListener, status, prompt, options); } catch(BackgroundException f) { log.warn("Failure {} using single upload. Throw original multipart failure {}", e, e); @@ -81,7 +83,7 @@ public StorageObject upload(final Write write, final Path file, L } } // Use single upload service - return new S3SingleUploadService(session).upload(write, file, local, throttle, progress, streamListener, status, prompt); + return new S3SingleUploadService(session).upload(write, file, local, throttle, progress, streamListener, status, prompt, options); } protected boolean threshold(final TransferStatus status) { diff --git a/s3/src/test/java/ch/cyberduck/core/cryptomator/S3MultipartUploadServiceTest.java b/s3/src/test/java/ch/cyberduck/core/cryptomator/S3MultipartUploadServiceTest.java index c53c19e2b46..5f92d0dd7b6 100644 --- a/s3/src/test/java/ch/cyberduck/core/cryptomator/S3MultipartUploadServiceTest.java +++ b/s3/src/test/java/ch/cyberduck/core/cryptomator/S3MultipartUploadServiceTest.java @@ -45,6 +45,7 @@ import ch.cyberduck.core.transfer.Transfer; import ch.cyberduck.core.transfer.TransferItem; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.DefaultVaultRegistry; import ch.cyberduck.core.vault.VaultCredentials; import ch.cyberduck.test.IntegrationTest; @@ -94,7 +95,7 @@ public void testUploadSinglePart() throws Exception { writeStatus.setHeader(cryptomator.getFileHeaderCryptor().encryptHeader(header)); writeStatus.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); - m.upload(new CryptoWriteFeature<>(session, new S3WriteFeature(session, acl), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, null); + m.upload(new CryptoWriteFeature<>(session, new S3WriteFeature(session, acl), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, null, new UploadFilterOptions(session.getHost())); assertEquals(content.length, count.getSent()); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new S3FindFeature(session, acl)).find(test)); @@ -128,7 +129,7 @@ public void testUpload() throws Exception { final FileHeader header = cryptomator.getFileHeaderCryptor().create(); writeStatus.setHeader(cryptomator.getFileHeaderCryptor().encryptHeader(header)); writeStatus.setLength(content.length); - m.upload(new CryptoWriteFeature<>(session, new S3WriteFeature(session, acl), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), writeStatus, null); + m.upload(new CryptoWriteFeature<>(session, new S3WriteFeature(session, acl), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), writeStatus, null, new UploadFilterOptions(session.getHost())); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new S3FindFeature(session, acl)).find(test)); assertEquals(content.length, cryptomator.getFeature(session, AttributesFinder.class, new S3AttributesFinderFeature(session, acl)).find(test).getSize()); @@ -161,7 +162,7 @@ public void testUploadWithBulk() throws Exception { cryptomator); final Local local = new Local(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString()); IOUtils.write(content, local.getOutputStream(false)); - m.upload(new CryptoWriteFeature<>(session, new S3WriteFeature(session, acl), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), writeStatus, null); + m.upload(new CryptoWriteFeature<>(session, new S3WriteFeature(session, acl), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), writeStatus, null, new UploadFilterOptions(session.getHost())); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new S3FindFeature(session, acl)).find(test)); assertEquals(content.length, cryptomator.getFeature(session, AttributesFinder.class, new S3AttributesFinderFeature(session, acl)).find(test).getSize()); diff --git a/s3/src/test/java/ch/cyberduck/core/cryptomator/S3SingleUploadServiceTest.java b/s3/src/test/java/ch/cyberduck/core/cryptomator/S3SingleUploadServiceTest.java index 9a5395beac7..14cbb8d31f4 100644 --- a/s3/src/test/java/ch/cyberduck/core/cryptomator/S3SingleUploadServiceTest.java +++ b/s3/src/test/java/ch/cyberduck/core/cryptomator/S3SingleUploadServiceTest.java @@ -40,6 +40,7 @@ import ch.cyberduck.core.s3.S3SingleUploadService; import ch.cyberduck.core.s3.S3WriteFeature; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.DefaultVaultRegistry; import ch.cyberduck.core.vault.VaultCredentials; import ch.cyberduck.test.IntegrationTest; @@ -86,7 +87,7 @@ public void testUploadVault() throws Exception { final CryptoUploadFeature m = new CryptoUploadFeature<>(session, new S3SingleUploadService(session), cryptomator); - m.upload(new CryptoWriteFeature<>(session, new S3WriteFeature(session, acl), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, null); + m.upload(new CryptoWriteFeature<>(session, new S3WriteFeature(session, acl), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, null, new UploadFilterOptions(session.getHost())); assertEquals(content.length, count.getSent()); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new S3FindFeature(session, acl)).find(test)); diff --git a/s3/src/test/java/ch/cyberduck/core/s3/S3MultipartUploadServiceTest.java b/s3/src/test/java/ch/cyberduck/core/s3/S3MultipartUploadServiceTest.java index 12277fd673b..ac89d062eee 100644 --- a/s3/src/test/java/ch/cyberduck/core/s3/S3MultipartUploadServiceTest.java +++ b/s3/src/test/java/ch/cyberduck/core/s3/S3MultipartUploadServiceTest.java @@ -26,6 +26,7 @@ import ch.cyberduck.core.io.StreamProgress; import ch.cyberduck.core.kms.KMSEncryptionFeature; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -63,7 +64,7 @@ public void testUploadSinglePart() throws Exception { status.setStorageClass(S3Object.STORAGE_CLASS_REDUCED_REDUNDANCY); final BytecountStreamListener count = new BytecountStreamListener(); service.upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), count, status, new DisabledLoginCallback()); + new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertEquals(random.length, count.getSent()); assertSame(Checksum.NONE, status.getResponse().getChecksum()); assertTrue(status.isComplete()); @@ -98,7 +99,7 @@ public void testUploadBucketInHostname() throws Exception { status.setStorageClass(S3Object.STORAGE_CLASS_REDUCED_REDUNDANCY); final BytecountStreamListener count = new BytecountStreamListener(); service.upload(new S3WriteFeature(virtualhost, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), count, status, new DisabledLoginCallback()); + new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertEquals(random.length, count.getSent()); assertSame(Checksum.NONE, status.getResponse().getChecksum()); assertTrue(status.isComplete()); @@ -135,7 +136,7 @@ public void testUploadSinglePartEncrypted() throws Exception { status.setStorageClass(S3Object.STORAGE_CLASS_REDUCED_REDUNDANCY); final BytecountStreamListener count = new BytecountStreamListener(); service.upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), count, status, new DisabledLoginCallback()); + new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertEquals(random.length, count.getSent()); assertSame(Checksum.NONE, status.getResponse().getChecksum()); assertEquals(random.length, status.getResponse().getSize()); @@ -159,7 +160,8 @@ public void testUploadInvalidContainer() throws Exception { final Path test = new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); final Local local = new Local(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString()); final TransferStatus status = new TransferStatus(); - m.upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, null); + m.upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, null, + new UploadFilterOptions(session.getHost())); } @Test @@ -176,7 +178,8 @@ public void testMultipleParts() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); - m.upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, null); + m.upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, null, + new UploadFilterOptions(session.getHost())); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); assertNotSame(PathAttributes.EMPTY, status.getResponse()); @@ -201,7 +204,7 @@ public void testMultiplePartsWithSHA256Checksum() throws Exception { status.setLength(content.length); status.setModified(System.currentTimeMillis()); final BytecountStreamListener count = new BytecountStreamListener(); - m.upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, null); + m.upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, null, new UploadFilterOptions(session.getHost())); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); assertNotSame(PathAttributes.EMPTY, status.getResponse()); @@ -230,17 +233,17 @@ public void testAppendSecondPart() throws Exception { final S3AccessControlListFeature acl = new S3AccessControlListFeature(session); final S3MultipartUploadService feature = new S3MultipartUploadService(session, acl, 10L * 1024L * 1024L, 1) { @Override - public StorageObject upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final StreamCancelation cancel, final StreamProgress progress, final ConnectionCallback callback) throws BackgroundException { + public StorageObject transfer(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final StreamCancelation cancel, final StreamProgress progress, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { if(status.getOffset() >= 10L * 1024L * 1024L) { throw new ConnectionTimeoutException("Test"); } - return super.upload(write, file, local, throttle, listener, status, cancel, progress, callback); + return super.transfer(write, file, local, throttle, listener, status, cancel, progress, callback, options); } }; try { feature.upload(new S3WriteFeature(session, acl), test, new Local(System.getProperty("java.io.tmpdir"), name), new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, - new DisabledLoginCallback()); + new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); } catch(BackgroundException e) { // Expected @@ -257,7 +260,7 @@ public StorageObject upload(final Write write, final Path file, f final TransferStatus append = new TransferStatus().setAppend(true).setLength(2L * 1024L * 1024L).setOffset(10L * 1024L * 1024L); new S3MultipartUploadService(session, acl, 10L * 1024L * 1024L, 1).upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, append, - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertEquals(12L * 1024L * 1024L, count.getSent()); assertTrue(append.isComplete()); assertNotSame(PathAttributes.EMPTY, append.getResponse()); @@ -301,7 +304,7 @@ protected void beforeRead(int n) throws IOException { }; } }, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); } catch(BackgroundException e) { // Expected @@ -316,7 +319,7 @@ protected void beforeRead(int n) throws IOException { new S3MultipartUploadService(session, acl, 10485760L, 1).upload( new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, append, - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertEquals(32769L, count.getSent()); assertTrue(append.isComplete()); assertEquals(content.length, append.getResponse().getSize()); diff --git a/s3/src/test/java/ch/cyberduck/core/s3/S3SingleUploadServiceTest.java b/s3/src/test/java/ch/cyberduck/core/s3/S3SingleUploadServiceTest.java index 47ddc2d5674..079200b8e3e 100644 --- a/s3/src/test/java/ch/cyberduck/core/s3/S3SingleUploadServiceTest.java +++ b/s3/src/test/java/ch/cyberduck/core/s3/S3SingleUploadServiceTest.java @@ -17,7 +17,6 @@ import ch.cyberduck.core.DisabledLoginCallback; import ch.cyberduck.core.DisabledProgressListener; -import ch.cyberduck.core.Host; import ch.cyberduck.core.Local; import ch.cyberduck.core.Path; import ch.cyberduck.core.PathAttributes; @@ -28,10 +27,10 @@ import ch.cyberduck.core.kms.KMSEncryptionFeature; import ch.cyberduck.core.local.LocalTouchFactory; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; -import org.apache.commons.io.input.NullInputStream; import org.apache.commons.lang3.RandomUtils; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -46,14 +45,6 @@ @Category(IntegrationTest.class) public class S3SingleUploadServiceTest extends AbstractS3Test { - @Test - public void testDecorate() throws Exception { - final NullInputStream n = new NullInputStream(1L); - final S3Session session = new S3Session(new Host(new S3Protocol())); - assertSame(NullInputStream.class, new S3SingleUploadService(session - ).decorate(n, null).getClass()); - } - @Test public void testUpload() throws Exception { final S3AccessControlListFeature acl = new S3AccessControlListFeature(session); @@ -70,7 +61,7 @@ public void testUpload() throws Exception { status.setLength(random.length); status.setMime("text/plain"); service.upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertTrue(new S3FindFeature(session, acl).find(test)); final PathAttributes attr = new S3AttributesFinderFeature(session, acl).find(test); assertEquals(status.getResponse().getChecksum(), attr.getChecksum()); @@ -96,7 +87,7 @@ public void testUploadSSE() throws Exception { status.setLength(random.length); status.setEncryption(KMSEncryptionFeature.SSE_KMS_DEFAULT); service.upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertTrue(new S3FindFeature(session, acl).find(test)); final PathAttributes attributes = new S3AttributesFinderFeature(session, acl).find(test); assertEquals(random.length, attributes.getSize()); @@ -119,7 +110,7 @@ public void testUploadWithSHA256Checksum() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(random.length); service.upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertTrue(new S3FindFeature(session, acl).find(test)); final PathAttributes attributes = new S3AttributesFinderFeature(session, acl).find(test); assertEquals(random.length, attributes.getSize()); @@ -136,6 +127,6 @@ public void testUploadInvalidContainer() throws Exception { LocalTouchFactory.get().touch(local); final TransferStatus status = new TransferStatus(); m.upload(new S3WriteFeature(session, new S3AccessControlListFeature(session)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), - status, new DisabledLoginCallback()); + status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); } } diff --git a/s3/src/test/java/ch/cyberduck/core/s3/S3ThresholdUploadServiceTest.java b/s3/src/test/java/ch/cyberduck/core/s3/S3ThresholdUploadServiceTest.java index 8a0981c2063..25dd1e27656 100644 --- a/s3/src/test/java/ch/cyberduck/core/s3/S3ThresholdUploadServiceTest.java +++ b/s3/src/test/java/ch/cyberduck/core/s3/S3ThresholdUploadServiceTest.java @@ -28,6 +28,7 @@ import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -54,7 +55,7 @@ public void testUploadInvalidContainer() throws Exception { final Path test = new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); final Local local = new NullLocal(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString()); final TransferStatus status = new TransferStatus().setLength(5 * 1024L); - m.upload(new S3WriteFeature(session, new S3AccessControlListFeature(session)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, null); + m.upload(new S3WriteFeature(session, new S3AccessControlListFeature(session)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, null, new UploadFilterOptions(session.getHost())); } @Test @@ -71,7 +72,7 @@ public void testUploadSinglePartEuCentral() throws Exception { status.setStorageClass(S3Object.STORAGE_CLASS_REDUCED_REDUNDANCY); final BytecountStreamListener count = new BytecountStreamListener(); service.upload(new S3WriteFeature(session, new S3AccessControlListFeature(session)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), count, status, new DisabledLoginCallback()); + new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertEquals(random.length, count.getSent(), 0L); assertTrue(status.isComplete()); assertTrue(new S3FindFeature(session, new S3AccessControlListFeature(session)).find(test)); @@ -96,7 +97,7 @@ public void testUploadSinglePartUsEast() throws Exception { status.setStorageClass(S3Object.STORAGE_CLASS_REDUCED_REDUNDANCY); final BytecountStreamListener count = new BytecountStreamListener(); service.upload(new S3WriteFeature(session, new S3AccessControlListFeature(session)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), count, status, new DisabledLoginCallback()); + new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertEquals(random.length, count.getSent()); assertTrue(status.isComplete()); assertTrue(new S3FindFeature(session, new S3AccessControlListFeature(session)).find(test)); @@ -122,7 +123,7 @@ public void testUploadZeroLength() throws Exception { status.setMime("text/plain"); final BytecountStreamListener count = new BytecountStreamListener(); service.upload(new S3WriteFeature(session, new S3AccessControlListFeature(session)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), count, status, new DisabledLoginCallback()); + new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); assertEquals(random.length, count.getSent()); assertTrue(status.isComplete()); assertTrue(new S3FindFeature(session, new S3AccessControlListFeature(session)).find(test)); diff --git a/s3/src/test/java/ch/cyberduck/core/worker/S3SingleTransferWorkerTest.java b/s3/src/test/java/ch/cyberduck/core/worker/S3SingleTransferWorkerTest.java index e88952037d9..baa4585f606 100644 --- a/s3/src/test/java/ch/cyberduck/core/worker/S3SingleTransferWorkerTest.java +++ b/s3/src/test/java/ch/cyberduck/core/worker/S3SingleTransferWorkerTest.java @@ -47,6 +47,7 @@ import ch.cyberduck.core.transfer.TransferSpeedometer; import ch.cyberduck.core.transfer.TransferStatus; import ch.cyberduck.core.transfer.UploadTransfer; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -61,7 +62,6 @@ import java.io.InputStream; import java.io.OutputStream; import java.net.SocketTimeoutException; -import java.security.MessageDigest; import java.util.Collections; import java.util.EnumSet; import java.util.HashSet; @@ -147,7 +147,7 @@ public T _getFeature(final Class type) { if(type == Upload.class) { return (T) new S3MultipartUploadService(this, new S3AccessControlListFeature(this), 5 * 1024L * 1024L, 5) { @Override - protected InputStream decorate(final InputStream in, final MessageDigest digest) { + protected InputStream decorate(final InputStream in, final UploadFilterOptions options) { if(failed.get()) { // Second attempt successful return in; @@ -225,7 +225,7 @@ public T _getFeature(final Class type) { if(type == Upload.class) { return (T) new S3SingleUploadService(this) { @Override - protected InputStream decorate(final InputStream in, final MessageDigest digest) { + protected InputStream decorate(final InputStream in, final UploadFilterOptions options) { if(failed.get()) { // Second attempt successful return in; diff --git a/spectra/src/main/java/ch/cyberduck/core/spectra/SpectraUploadFeature.java b/spectra/src/main/java/ch/cyberduck/core/spectra/SpectraUploadFeature.java index 50b15aa60f9..4f47ac410fd 100644 --- a/spectra/src/main/java/ch/cyberduck/core/spectra/SpectraUploadFeature.java +++ b/spectra/src/main/java/ch/cyberduck/core/spectra/SpectraUploadFeature.java @@ -30,12 +30,13 @@ import ch.cyberduck.core.transfer.Transfer; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; + import org.jets3t.service.model.StorageObject; -import java.security.MessageDigest; import java.util.List; -public class SpectraUploadFeature extends HttpUploadFeature { +public class SpectraUploadFeature extends HttpUploadFeature { private final SpectraBulkService bulk; @@ -45,7 +46,7 @@ public SpectraUploadFeature(final SpectraBulkService bulk) { @Override public StorageObject upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, - final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { + final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { if(Checksum.NONE == status.getChecksum()) { // The client-side checksum is passed to the BlackPearl gateway by supplying the applicable CRC HTTP header. // If this is done, the BlackPearl gateway verifies that the data received matches the checksum provided. @@ -60,7 +61,7 @@ public StorageObject upload(final Write write, final Path file, f StorageObject stored = null; for(TransferStatus chunk : chunks) { chunk.setChecksum(ChecksumComputeFactory.get(HashAlgorithm.md5).compute(local.getInputStream(), chunk)); - stored = super.upload(write, file, local, throttle, progress, streamListener, chunk, callback); + stored = super.upload(write, file, local, throttle, progress, streamListener, chunk, callback, options); } return stored; } diff --git a/spectra/src/test/java/ch/cyberduck/core/spectra/SpectraUploadFeatureTest.java b/spectra/src/test/java/ch/cyberduck/core/spectra/SpectraUploadFeatureTest.java index cc07f2fcba7..52197fd7845 100644 --- a/spectra/src/test/java/ch/cyberduck/core/spectra/SpectraUploadFeatureTest.java +++ b/spectra/src/test/java/ch/cyberduck/core/spectra/SpectraUploadFeatureTest.java @@ -27,6 +27,7 @@ import ch.cyberduck.core.transfer.Transfer; import ch.cyberduck.core.transfer.TransferItem; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -62,7 +63,7 @@ public void testUpload() throws Exception { bulk.pre(Transfer.Type.upload, Collections.singletonMap(new TransferItem(test), writeStatus), new DisabledConnectionCallback()); final SpectraUploadFeature upload = new SpectraUploadFeature(new SpectraBulkService(session)); upload.upload(new SpectraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), - writeStatus, new DisabledConnectionCallback()); + writeStatus, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final byte[] buffer = new byte[content.length]; final TransferStatus readStatus = new TransferStatus().setLength(content.length); bulk.pre(Transfer.Type.download, Collections.singletonMap(new TransferItem(test), readStatus), new DisabledConnectionCallback()); @@ -107,9 +108,9 @@ public void testUploadMultipleFiles() throws Exception { bulk.pre(Transfer.Type.upload, files, new DisabledConnectionCallback()); final SpectraUploadFeature upload = new SpectraUploadFeature(new SpectraBulkService(session)); upload.upload(new SpectraWriteFeature(session), test1, local1, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), - status1, new DisabledConnectionCallback()); + status1, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); upload.upload(new SpectraWriteFeature(session), test2, local2, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), - status2, new DisabledConnectionCallback()); + status2, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); new SpectraDeleteFeature(session).delete(Arrays.asList(test1, test2), new DisabledLoginCallback(), new Delete.DisabledCallback()); local1.delete(); local2.delete(); diff --git a/ssh/src/main/java/ch/cyberduck/core/sftp/SFTPUploadFeature.java b/ssh/src/main/java/ch/cyberduck/core/sftp/SFTPUploadFeature.java index 428690ef342..bb7948e0134 100644 --- a/ssh/src/main/java/ch/cyberduck/core/sftp/SFTPUploadFeature.java +++ b/ssh/src/main/java/ch/cyberduck/core/sftp/SFTPUploadFeature.java @@ -25,7 +25,7 @@ public class SFTPUploadFeature extends DefaultUploadFeature { public SFTPUploadFeature(final Session session) { - super(session); + super(); } @Override diff --git a/ssh/src/test/java/ch/cyberduck/core/shared/DefaultUploadFeatureTest.java b/ssh/src/test/java/ch/cyberduck/core/shared/DefaultUploadFeatureTest.java index 73707a9fbc9..919e334bd90 100644 --- a/ssh/src/test/java/ch/cyberduck/core/shared/DefaultUploadFeatureTest.java +++ b/ssh/src/test/java/ch/cyberduck/core/shared/DefaultUploadFeatureTest.java @@ -30,6 +30,7 @@ import ch.cyberduck.core.sftp.SFTPHomeDirectoryService; import ch.cyberduck.core.sftp.SFTPWriteFeature; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -59,17 +60,17 @@ public void testTransferAppend() throws Exception { final Path test = new Path(new SFTPHomeDirectoryService(session).find(), UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); { final TransferStatus status = new TransferStatus().setLength(content.length / 2); - new DefaultUploadFeature(session).upload( + new DefaultUploadFeature().upload( new SFTPWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); } { final TransferStatus status = new TransferStatus().setLength(content.length / 2).setOffset(content.length / 2).setAppend(true); - new DefaultUploadFeature(session).upload( + new DefaultUploadFeature().upload( new SFTPWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); } final byte[] buffer = new byte[content.length]; final Read read = session.getFeature(Read.class); diff --git a/storegate/src/test/java/ch/cyberduck/core/storegate/StoregateReadFeatureTest.java b/storegate/src/test/java/ch/cyberduck/core/storegate/StoregateReadFeatureTest.java index b9060589b2c..06a597ea626 100644 --- a/storegate/src/test/java/ch/cyberduck/core/storegate/StoregateReadFeatureTest.java +++ b/storegate/src/test/java/ch/cyberduck/core/storegate/StoregateReadFeatureTest.java @@ -30,6 +30,7 @@ import ch.cyberduck.core.shared.DefaultUploadFeature; import ch.cyberduck.core.storegate.io.swagger.client.model.File; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -111,9 +112,9 @@ public void testReadRange() throws Exception { out.close(); final TransferStatus upload = new TransferStatus().setLength(content.length); upload.setExists(true); - new DefaultUploadFeature(session).upload( + new DefaultUploadFeature().upload( new StoregateWriteFeature(session, nodeid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), upload, - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); @@ -145,9 +146,9 @@ public void testReadRangeUnknownLength() throws Exception { out.close(); final TransferStatus upload = new TransferStatus().setLength(content.length); upload.setExists(true); - new DefaultUploadFeature(session).upload( + new DefaultUploadFeature().upload( new StoregateWriteFeature(session, nodeid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), upload, - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final TransferStatus status = new TransferStatus(); status.setLength(-1L); status.setAppend(true); diff --git a/tus/src/main/java/ch/cyberduck/core/tus/TusUploadFeature.java b/tus/src/main/java/ch/cyberduck/core/tus/TusUploadFeature.java index b4f1485602c..09147380a0e 100644 --- a/tus/src/main/java/ch/cyberduck/core/tus/TusUploadFeature.java +++ b/tus/src/main/java/ch/cyberduck/core/tus/TusUploadFeature.java @@ -41,6 +41,8 @@ import ch.cyberduck.core.threading.DefaultRetryCallable; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; + import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.concurrent.ConcurrentUtils; @@ -57,7 +59,6 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; -import java.security.MessageDigest; import java.util.ArrayList; import java.util.EnumSet; import java.util.HashMap; @@ -67,7 +68,7 @@ import static ch.cyberduck.core.tus.TusCapabilities.*; -public class TusUploadFeature extends HttpUploadFeature { +public class TusUploadFeature extends HttpUploadFeature { private static final Logger log = LogManager.getLogger(TusUploadFeature.class); public static final String UPLOAD_URL = "uploadUrl"; @@ -86,7 +87,7 @@ public TusUploadFeature(final Host host, final DAVClient client, final TusCapabi @Override public Void upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { + final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { // In order to achieve parallel upload the Concatenation extension MAY be used. try { final List> chunks = new ArrayList<>(); @@ -140,7 +141,7 @@ public String handleResponse(final HttpResponse response) throws HttpResponseExc while(remaining > 0) { final long length = Math.min(preferences.getInteger("tus.chunk.size"), remaining); chunks.add(this.submit(write, file, local, throttle, streamListener, status, - uploadUrl, offset, length, callback)); + uploadUrl, offset, length, callback, options)); remaining -= length; offset += length; } @@ -162,7 +163,7 @@ public String handleResponse(final HttpResponse response) throws HttpResponseExc private Future submit(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus overall, final String uploadUrl, - final long offset, final long length, final ConnectionCallback callback) throws BackgroundException { + final long offset, final long length, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { overall.validate(); log.info("Send part of {} with offset {} and length {}", file, offset, length); return ConcurrentUtils.constantFuture(new DefaultRetryCallable<>(host, new BackgroundExceptionCallable() { @@ -178,8 +179,8 @@ public Void call() throws BackgroundException { final Map parameters = new HashMap<>(); parameters.put(UPLOAD_URL, uploadUrl); status.setParameters(parameters); - final Void response = TusUploadFeature.this.upload( - write, file, local, throttle, listener, status, overall, status, callback); + final Void response = TusUploadFeature.this.transfer( + write, file, local, throttle, listener, status, overall, status, callback, options); log.info("Received response {}", response); return null; } diff --git a/webdav/src/main/java/ch/cyberduck/core/dav/DAVSession.java b/webdav/src/main/java/ch/cyberduck/core/dav/DAVSession.java index 31c7eac5ed5..32792f59627 100644 --- a/webdav/src/main/java/ch/cyberduck/core/dav/DAVSession.java +++ b/webdav/src/main/java/ch/cyberduck/core/dav/DAVSession.java @@ -309,7 +309,7 @@ public T _getFeature(final Class type) { return (T) new DAVWriteFeature(this, capabilities.expectcontinue); } if(type == Upload.class) { - return (T) new DAVUploadFeature(this); + return (T) new DAVUploadFeature(); } if(type == Delete.class) { return (T) new DAVDeleteFeature(this); diff --git a/webdav/src/main/java/ch/cyberduck/core/dav/DAVUploadFeature.java b/webdav/src/main/java/ch/cyberduck/core/dav/DAVUploadFeature.java index 498ba35114e..80c4eb08c0d 100644 --- a/webdav/src/main/java/ch/cyberduck/core/dav/DAVUploadFeature.java +++ b/webdav/src/main/java/ch/cyberduck/core/dav/DAVUploadFeature.java @@ -23,13 +23,7 @@ import ch.cyberduck.core.http.HttpUploadFeature; import ch.cyberduck.core.transfer.TransferStatus; -import java.security.MessageDigest; - -public class DAVUploadFeature extends HttpUploadFeature { - - public DAVUploadFeature(final DAVSession session) { - - } +public class DAVUploadFeature extends HttpUploadFeature { @Override public Write.Append append(final Path file, final TransferStatus status) throws BackgroundException { diff --git a/webdav/src/test/java/ch/cyberduck/core/cryptomator/DAVReadFeatureTest.java b/webdav/src/test/java/ch/cyberduck/core/cryptomator/DAVReadFeatureTest.java index 3f38d3f3b81..0d25a3db056 100644 --- a/webdav/src/test/java/ch/cyberduck/core/cryptomator/DAVReadFeatureTest.java +++ b/webdav/src/test/java/ch/cyberduck/core/cryptomator/DAVReadFeatureTest.java @@ -87,7 +87,7 @@ public void testReadRange() throws Exception { out.close(); assertTrue(cryptomator.getFeature(session, Find.class, new DAVFindFeature(session)).find(test)); assertEquals(content.length, new CryptoListService(session, new DAVListService(session), cryptomator).list(test.getParent(), new DisabledListProgressListener()).get(test).attributes().getSize()); - assertEquals(content.length, new CryptoUploadFeature<>(session, new DAVUploadFeature(session), cryptomator).append(test, status.setRemote(cryptomator.getFeature(session, AttributesFinder.class, new DAVAttributesFinderFeature(session)).find(test))).offset, 0L); + assertEquals(content.length, new CryptoUploadFeature<>(session, new DAVUploadFeature(), cryptomator).append(test, status.setRemote(cryptomator.getFeature(session, AttributesFinder.class, new DAVAttributesFinderFeature(session)).find(test))).offset, 0L); { final ByteArrayOutputStream buffer = new ByteArrayOutputStream(40000); final TransferStatus read = new TransferStatus(); diff --git a/webdav/src/test/java/ch/cyberduck/core/cryptomator/DAVWriteFeatureTest.java b/webdav/src/test/java/ch/cyberduck/core/cryptomator/DAVWriteFeatureTest.java index 1ca8f86568d..d8ed3995bdb 100644 --- a/webdav/src/test/java/ch/cyberduck/core/cryptomator/DAVWriteFeatureTest.java +++ b/webdav/src/test/java/ch/cyberduck/core/cryptomator/DAVWriteFeatureTest.java @@ -87,7 +87,7 @@ public void testWrite() throws Exception { out.close(); assertTrue(cryptomator.getFeature(session, Find.class, new DAVFindFeature(session)).find(test)); assertEquals(content.length, new CryptoListService(session, new DAVListService(session), cryptomator).list(test.getParent(), new DisabledListProgressListener()).get(test).attributes().getSize()); - assertEquals(content.length, new CryptoUploadFeature<>(session, new DAVUploadFeature(session), cryptomator).append(test, status + assertEquals(content.length, new CryptoUploadFeature<>(session, new DAVUploadFeature(), cryptomator).append(test, status .setRemote(cryptomator.getFeature(session, AttributesFinder.class, new DAVAttributesFinderFeature(session)).find(test))).offset, 0L); final ByteArrayOutputStream buffer = new ByteArrayOutputStream(content.length); final InputStream in = new CryptoReadFeature(session, new DAVReadFeature(session), cryptomator).read(test, new TransferStatus().setLength(content.length), new DisabledConnectionCallback()); diff --git a/webdav/src/test/java/ch/cyberduck/core/dav/DAVLockFeatureTest.java b/webdav/src/test/java/ch/cyberduck/core/dav/DAVLockFeatureTest.java index 4ebe667583d..44250a12150 100644 --- a/webdav/src/test/java/ch/cyberduck/core/dav/DAVLockFeatureTest.java +++ b/webdav/src/test/java/ch/cyberduck/core/dav/DAVLockFeatureTest.java @@ -28,6 +28,7 @@ import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -52,9 +53,9 @@ public void testLockNotSupported() throws Exception { out.close(); status.setLength(content.length); final Path test = new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); - final HttpUploadFeature upload = new DAVUploadFeature(session); + final HttpUploadFeature upload = new DAVUploadFeature(); upload.upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); String lock = null; try { lock = new DAVLockFeature(session).lock(test); diff --git a/webdav/src/test/java/ch/cyberduck/core/dav/DAVReadFeatureTest.java b/webdav/src/test/java/ch/cyberduck/core/dav/DAVReadFeatureTest.java index 7a6b39ac7a2..06fca8ceab3 100644 --- a/webdav/src/test/java/ch/cyberduck/core/dav/DAVReadFeatureTest.java +++ b/webdav/src/test/java/ch/cyberduck/core/dav/DAVReadFeatureTest.java @@ -14,6 +14,7 @@ import ch.cyberduck.core.shared.DefaultDownloadFeature; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -55,10 +56,10 @@ public void testReadChunkedTransfer() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DAVUploadFeature(session).upload( + new DAVUploadFeature().upload( new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); // Unknown length in status final TransferStatus status = new TransferStatus() { @Override @@ -103,10 +104,10 @@ public void testReadRange() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DAVUploadFeature(session).upload( + new DAVUploadFeature().upload( new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); @@ -131,10 +132,10 @@ public void testReadRangeUnknownLength() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DAVUploadFeature(session).upload( + new DAVUploadFeature().upload( new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final TransferStatus status = new TransferStatus(); status.setLength(-1L); status.setAppend(true); diff --git a/webdav/src/test/java/ch/cyberduck/core/dav/DAVUploadFeatureTest.java b/webdav/src/test/java/ch/cyberduck/core/dav/DAVUploadFeatureTest.java index cde943a0569..32ea512c1c5 100644 --- a/webdav/src/test/java/ch/cyberduck/core/dav/DAVUploadFeatureTest.java +++ b/webdav/src/test/java/ch/cyberduck/core/dav/DAVUploadFeatureTest.java @@ -30,6 +30,7 @@ import ch.cyberduck.core.local.DefaultLocalTouchFeature; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -56,10 +57,10 @@ public void testAccessDenied() throws Exception { new DefaultLocalTouchFeature().touch(local); final Path test = new Path(new Path("/dav/accessdenied", EnumSet.of(Path.Type.directory)), "nosuchname", EnumSet.of(Path.Type.file)); try { - new DAVUploadFeature(session).upload( + new DAVUploadFeature().upload( new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); } catch(AccessDeniedException e) { assertEquals("Unexpected response (403 Forbidden). Please contact your web hosting service provider for assistance.", e.getDetail()); @@ -81,17 +82,17 @@ public void testAppend() throws Exception { final Path test = new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); { final TransferStatus status = new TransferStatus().setLength(content.length / 2); - new DAVUploadFeature(session).upload( + new DAVUploadFeature().upload( new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); } { final TransferStatus status = new TransferStatus().setLength(content.length / 2).setOffset(content.length / 2).setAppend(true); - new DAVUploadFeature(session).upload( + new DAVUploadFeature().upload( new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); } final byte[] buffer = new byte[content.length]; final InputStream in = new DAVReadFeature(session).read(test, new TransferStatus().setLength(content.length), new DisabledConnectionCallback()); @@ -104,7 +105,7 @@ public void testAppend() throws Exception { @Test public void testAppendZeroBytes() throws Exception { - final DAVUploadFeature feature = new DAVUploadFeature(session); + final DAVUploadFeature feature = new DAVUploadFeature(); final Path test = new DAVTouchFeature(session).touch(new DAVWriteFeature(session), new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus()); assertTrue(feature.append(test, new TransferStatus().setExists(true).setLength(0L).setRemote(new DAVAttributesFinderFeature(session).find(test))).append); new DAVDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); diff --git a/webdav/src/test/java/ch/cyberduck/core/dav/DAVWriteFeatureTest.java b/webdav/src/test/java/ch/cyberduck/core/dav/DAVWriteFeatureTest.java index e47bfed81ee..50d5a5372e7 100644 --- a/webdav/src/test/java/ch/cyberduck/core/dav/DAVWriteFeatureTest.java +++ b/webdav/src/test/java/ch/cyberduck/core/dav/DAVWriteFeatureTest.java @@ -19,6 +19,7 @@ import ch.cyberduck.core.shared.DefaultAttributesFinderFeature; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -52,12 +53,12 @@ public void testReadWrite() throws Exception { out.close(); status.setLength(content.length); final Path test = new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); - final HttpUploadFeature upload = new DAVUploadFeature(session); + final HttpUploadFeature upload = new DAVUploadFeature(); upload.upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertTrue(session.getFeature(Find.class).find(test)); assertEquals(content.length, new DAVListService(session).list(test.getParent(), new DisabledListProgressListener()).get(test).attributes().getSize(), 0L); - assertEquals(content.length, new DAVUploadFeature(session).append(test, status.setRemote(new DAVAttributesFinderFeature(session).find(test))).offset, 0L); + assertEquals(content.length, new DAVUploadFeature().append(test, status.setRemote(new DAVAttributesFinderFeature(session).find(test))).offset, 0L); { final byte[] buffer = new byte[content.length]; IOUtils.readFully(new DAVReadFeature(session).read(test, new TransferStatus(), new DisabledConnectionCallback()), buffer); @@ -85,12 +86,12 @@ public void testReadWriteChunkedTransfer() throws Exception { out.close(); status.setLength(TransferStatus.UNKNOWN_LENGTH); final Path test = new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); - final HttpUploadFeature upload = new DAVUploadFeature(session); + final HttpUploadFeature upload = new DAVUploadFeature(); upload.upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertTrue(session.getFeature(Find.class).find(test)); assertEquals(content.length, new DAVListService(session).list(test.getParent(), new DisabledListProgressListener()).get(test).attributes().getSize(), 0L); - assertEquals(content.length, new DAVUploadFeature(session).append(test, status.setRemote(new DAVAttributesFinderFeature(session).find(test))).offset, 0L); + assertEquals(content.length, new DAVUploadFeature().append(test, status.setRemote(new DAVAttributesFinderFeature(session).find(test))).offset, 0L); { final byte[] buffer = new byte[content.length]; IOUtils.readFully(new DAVReadFeature(session).read(test, new TransferStatus(), new DisabledConnectionCallback()), buffer); @@ -113,7 +114,7 @@ public void testReplaceContent() throws Exception { final Local local = new Local(System.getProperty("java.io.tmpdir"), new AlphanumericRandomStringService().random()); final Path folder = new DAVDirectoryFeature(session).mkdir(new DAVWriteFeature(session), new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus()); final Path test = new Path(folder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); - final HttpUploadFeature upload = new DAVUploadFeature(session); + final HttpUploadFeature upload = new DAVUploadFeature(); { final String folderEtag = new DAVAttributesFinderFeature(session).find(folder).getETag(); final byte[] content = RandomUtils.nextBytes(100); @@ -123,7 +124,7 @@ public void testReplaceContent() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(content.length); upload.upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertNotEquals(folderEtag, new DAVAttributesFinderFeature(session).find(folder).getETag()); } final PathAttributes attr1 = new DAVAttributesFinderFeature(session).find(test); @@ -137,7 +138,7 @@ public void testReplaceContent() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(content.length); upload.upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); assertEquals(folderEtag, new DAVAttributesFinderFeature(session).find(folder).getETag()); assertNotEquals(fileEtag, new DAVAttributesFinderFeature(session).find(test).getETag()); } diff --git a/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVLockFeatureTest.java b/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVLockFeatureTest.java index c1eddbf4b5a..d5c367f6a7d 100644 --- a/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVLockFeatureTest.java +++ b/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVLockFeatureTest.java @@ -33,6 +33,7 @@ import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -60,14 +61,14 @@ public void testLock() throws Exception { out.close(); status.setLength(content.length); final Path test = new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); - final HttpUploadFeature upload = new DAVUploadFeature(session); + final HttpUploadFeature upload = new DAVUploadFeature(); upload.upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback()); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final String lock = new DAVLockFeature(session).lock(test); assertTrue(new MicrosoftIISDAVFindFeature(session).find(test)); final PathAttributes attributes = new MicrosoftIISDAVListService(session, new MicrosoftIISDAVAttributesFinderFeature(session)).list(test.getParent(), new DisabledListProgressListener()).get(test).attributes(); assertEquals(content.length, attributes.getSize(), 0L); - assertEquals(content.length, new DAVUploadFeature(session).append(test, status.setRemote(attributes)).offset, 0L); + assertEquals(content.length, new DAVUploadFeature().append(test, status.setRemote(attributes)).offset, 0L); { final byte[] buffer = new byte[content.length]; IOUtils.readFully(new MicrosoftIISDAVReadFeature(session).read(test, new TransferStatus(), new DisabledConnectionCallback()), buffer); diff --git a/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVReadFeatureTest.java b/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVReadFeatureTest.java index f06817d01d8..d9d0a44b497 100644 --- a/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVReadFeatureTest.java +++ b/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVReadFeatureTest.java @@ -31,6 +31,7 @@ import ch.cyberduck.core.io.StreamCopier; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -66,10 +67,10 @@ public void testReadConcurrency() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DAVUploadFeature(session).upload( + new DAVUploadFeature().upload( new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); final ExecutorService service = Executors.newCachedThreadPool(); final BlockingQueue> queue = new LinkedBlockingQueue<>(); final CompletionService completion = new ExecutorCompletionService<>(service, queue); diff --git a/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVUploadFeatureTest.java b/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVUploadFeatureTest.java index 9699d47379a..b5c72d3d376 100644 --- a/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVUploadFeatureTest.java +++ b/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVUploadFeatureTest.java @@ -30,6 +30,7 @@ import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -58,10 +59,10 @@ public void testUpload() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DAVUploadFeature(session).upload( + new DAVUploadFeature().upload( new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); new DAVDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); local.delete(); } @@ -78,10 +79,10 @@ public void testUploadNoConnectionInPool() throws Exception { // Close connections in pool to require new NTLM handshake final ClientConnectionManager manager = session.getClient().getClient().getConnectionManager(); manager.closeIdleConnections(0L, TimeUnit.MILLISECONDS); - assertThrows(InteroperabilityException.class, () -> new DAVUploadFeature(session).upload( + assertThrows(InteroperabilityException.class, () -> new DAVUploadFeature().upload( new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback())); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost()))); local.delete(); } @@ -97,10 +98,10 @@ public void testZeroByteUploadNoConnectionInPool() throws Exception { // Close connections in pool to require new NTLM handshake final ClientConnectionManager manager = session.getClient().getClient().getConnectionManager(); manager.closeIdleConnections(0L, TimeUnit.MILLISECONDS); - new DAVUploadFeature(session).upload( + new DAVUploadFeature().upload( new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback()); + new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); new DAVDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); local.delete(); } diff --git a/webdav/src/test/java/ch/cyberduck/core/worker/DAVConcurrentTransferWorkerTest.java b/webdav/src/test/java/ch/cyberduck/core/worker/DAVConcurrentTransferWorkerTest.java index 764b51d40ad..37706c930c0 100644 --- a/webdav/src/test/java/ch/cyberduck/core/worker/DAVConcurrentTransferWorkerTest.java +++ b/webdav/src/test/java/ch/cyberduck/core/worker/DAVConcurrentTransferWorkerTest.java @@ -48,6 +48,7 @@ import ch.cyberduck.core.transfer.TransferOptions; import ch.cyberduck.core.transfer.TransferSpeedometer; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.DefaultVaultRegistry; import ch.cyberduck.test.IntegrationTest; @@ -80,7 +81,8 @@ public void testLargeUpAndDownload() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DAVUploadFeature(session).upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), new DisabledConnectionCallback()); + new DAVUploadFeature().upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), new DisabledConnectionCallback(), + new UploadFilterOptions(session.getHost())); assertEquals(content.length, new DAVAttributesFinderFeature(session).find(test).getSize()); final Local localFile = new DefaultTemporaryFileService().create(test.getName()); final Transfer download = new DownloadTransfer(new Host(new TestProtocol()), Collections.singletonList(new TransferItem(test, localFile)), new NullFilter<>()); @@ -113,7 +115,8 @@ public void testDownloadTransferWithFailure() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DAVUploadFeature(session).upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), new DisabledConnectionCallback()); + new DAVUploadFeature().upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), new DisabledConnectionCallback(), + new UploadFilterOptions(session.getHost())); final AtomicBoolean failed = new AtomicBoolean(); final Host host = new Host(session.getHost()) { @Override diff --git a/webdav/src/test/java/ch/cyberduck/core/worker/DAVSingleTransferWorkerTest.java b/webdav/src/test/java/ch/cyberduck/core/worker/DAVSingleTransferWorkerTest.java index 3f8277d7b28..4febe1d33f5 100644 --- a/webdav/src/test/java/ch/cyberduck/core/worker/DAVSingleTransferWorkerTest.java +++ b/webdav/src/test/java/ch/cyberduck/core/worker/DAVSingleTransferWorkerTest.java @@ -53,6 +53,7 @@ import ch.cyberduck.core.transfer.TransferOptions; import ch.cyberduck.core.transfer.TransferSpeedometer; import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -83,7 +84,8 @@ public void testDownloadTransferWithFailure() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DAVUploadFeature(session).upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), new DisabledConnectionCallback()); + new DAVUploadFeature().upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), new DisabledConnectionCallback(), + new UploadFilterOptions(session.getHost())); final AtomicBoolean failed = new AtomicBoolean(); final Host host = new Host(session.getHost()) { @Override From 1d9392a92f03f8d65c98a8b62cdc992ffb2416d6 Mon Sep 17 00:00:00 2001 From: David Kocher Date: Thu, 20 Nov 2025 17:21:51 +0100 Subject: [PATCH 2/7] Updated localization. --- .../download/AbstractDownloadFilter.java | 4 ++-- .../transfer/upload/AbstractUploadFilter.java | 2 +- .../core/eue/EueLargeUploadService.java | 4 ++-- .../core/eue/EueMultipartWriteFeature.java | 4 ++-- .../src/main/resources/ar.lproj/Error.strings | Bin 3910 -> 3914 bytes .../src/main/resources/bg.lproj/Error.strings | Bin 4188 -> 4192 bytes .../src/main/resources/ca.lproj/Error.strings | Bin 4424 -> 4428 bytes .../src/main/resources/cs.lproj/Error.strings | Bin 4126 -> 4128 bytes .../src/main/resources/cy.lproj/Error.strings | Bin 4042 -> 4046 bytes .../src/main/resources/da.lproj/Error.strings | Bin 4186 -> 4188 bytes .../src/main/resources/de.lproj/Error.strings | Bin 4614 -> 4616 bytes .../src/main/resources/el.lproj/Error.strings | Bin 4518 -> 4520 bytes .../src/main/resources/en.lproj/Error.strings | Bin 4036 -> 4040 bytes .../src/main/resources/es.lproj/Error.strings | Bin 4488 -> 4490 bytes .../src/main/resources/et.lproj/Error.strings | Bin 4156 -> 4160 bytes .../src/main/resources/fi.lproj/Error.strings | Bin 4290 -> 4292 bytes .../src/main/resources/fr.lproj/Error.strings | Bin 4508 -> 4510 bytes .../src/main/resources/he.lproj/Error.strings | Bin 3948 -> 3952 bytes .../src/main/resources/hr.lproj/Error.strings | Bin 4376 -> 4378 bytes .../src/main/resources/hu.lproj/Error.strings | Bin 4300 -> 4302 bytes .../src/main/resources/it.lproj/Error.strings | Bin 4448 -> 4450 bytes .../src/main/resources/ja.lproj/Error.strings | Bin 3768 -> 3772 bytes .../src/main/resources/ka.lproj/Error.strings | Bin 4164 -> 4168 bytes .../src/main/resources/ko.lproj/Error.strings | Bin 3566 -> 3568 bytes .../src/main/resources/lv.lproj/Error.strings | Bin 4052 -> 4054 bytes .../src/main/resources/nl.lproj/Error.strings | Bin 4358 -> 4360 bytes .../src/main/resources/no.lproj/Error.strings | Bin 4122 -> 4126 bytes .../src/main/resources/pl.lproj/Error.strings | Bin 4316 -> 4318 bytes .../main/resources/pt_BR.lproj/Error.strings | Bin 4452 -> 4454 bytes .../main/resources/pt_PT.lproj/Error.strings | Bin 4436 -> 4438 bytes .../src/main/resources/ro.lproj/Error.strings | Bin 4082 -> 4086 bytes .../src/main/resources/ru.lproj/Error.strings | Bin 4296 -> 4298 bytes .../src/main/resources/sk.lproj/Error.strings | Bin 4190 -> 4192 bytes .../src/main/resources/sl.lproj/Error.strings | Bin 4284 -> 4288 bytes .../src/main/resources/sr.lproj/Error.strings | Bin 4296 -> 4300 bytes .../src/main/resources/sv.lproj/Error.strings | Bin 4172 -> 4174 bytes .../main/resources/ta_IN.lproj/Error.strings | Bin 4296 -> 4298 bytes .../src/main/resources/th.lproj/Error.strings | Bin 4040 -> 4044 bytes .../src/main/resources/tr.lproj/Error.strings | Bin 4110 -> 4112 bytes .../src/main/resources/uk.lproj/Error.strings | Bin 4128 -> 4130 bytes .../main/resources/zh_CN.lproj/Error.strings | Bin 3198 -> 3200 bytes .../main/resources/zh_TW.lproj/Error.strings | Bin 3344 -> 3348 bytes .../core/irods/IRODSUploadFeature.java | 4 ++-- .../core/s3/S3MultipartUploadService.java | 2 +- .../core/s3/S3MultipartWriteFeature.java | 2 +- 45 files changed, 11 insertions(+), 11 deletions(-) diff --git a/core/src/main/java/ch/cyberduck/core/transfer/download/AbstractDownloadFilter.java b/core/src/main/java/ch/cyberduck/core/transfer/download/AbstractDownloadFilter.java index bdcb78d8af4..13718218343 100644 --- a/core/src/main/java/ch/cyberduck/core/transfer/download/AbstractDownloadFilter.java +++ b/core/src/main/java/ch/cyberduck/core/transfer/download/AbstractDownloadFilter.java @@ -354,8 +354,8 @@ public void complete(final Path file, final Local local, if(!checksum.equals(download)) { throw new ChecksumException( MessageFormat.format(LocaleFactory.localizedString("Download {0} failed", "Error"), file.getName()), - MessageFormat.format(LocaleFactory.localizedString("Mismatch between {0} hash {1} of downloaded data and checksum {2} returned by the server", "Error"), - download.algorithm.toString(), download.hash, checksum.hash)); + MessageFormat.format(LocaleFactory.localizedString("Mismatch between {2} checksum {0} of transfered data and {1} returned by the server", "Error"), + download.algorithm.toString(), download.hash, checksum.hash, checksum.algorithm)); } } } diff --git a/core/src/main/java/ch/cyberduck/core/transfer/upload/AbstractUploadFilter.java b/core/src/main/java/ch/cyberduck/core/transfer/upload/AbstractUploadFilter.java index 0b7272d8641..7cbefbdd385 100644 --- a/core/src/main/java/ch/cyberduck/core/transfer/upload/AbstractUploadFilter.java +++ b/core/src/main/java/ch/cyberduck/core/transfer/upload/AbstractUploadFilter.java @@ -387,7 +387,7 @@ public void complete(final Path file, final Local local, throw new ChecksumException( MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()), MessageFormat.format(LocaleFactory.localizedString("Mismatch between {2} checksum {0} of transfered data and {1} returned by the server", "Error"), - response.algorithm.toString(), response.hash, checksum.hash)); + response.hash, checksum.hash, response.algorithm.toString())); } } } diff --git a/eue/src/main/java/ch/cyberduck/core/eue/EueLargeUploadService.java b/eue/src/main/java/ch/cyberduck/core/eue/EueLargeUploadService.java index 1db63259ae6..d147f24612d 100644 --- a/eue/src/main/java/ch/cyberduck/core/eue/EueLargeUploadService.java +++ b/eue/src/main/java/ch/cyberduck/core/eue/EueLargeUploadService.java @@ -129,8 +129,8 @@ public EueWriteFeature.Chunk upload(final Write write, fi } else { throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()), - MessageFormat.format("Mismatch between {0} hash {1} of transfered data and {2} returned by the server", - HashAlgorithm.cdash64, cdash64, completedUploadResponse.getCdash64())); + MessageFormat.format("Mismatch between {2} checksum {0} of transfered data and {1} returned by the server", + cdash64, completedUploadResponse.getCdash64(), HashAlgorithm.cdash64)); } } final EueWriteFeature.Chunk object = new EueWriteFeature.Chunk(resourceId, size, cdash64); diff --git a/eue/src/main/java/ch/cyberduck/core/eue/EueMultipartWriteFeature.java b/eue/src/main/java/ch/cyberduck/core/eue/EueMultipartWriteFeature.java index 613a3655f6b..cb3eb0135ef 100644 --- a/eue/src/main/java/ch/cyberduck/core/eue/EueMultipartWriteFeature.java +++ b/eue/src/main/java/ch/cyberduck/core/eue/EueMultipartWriteFeature.java @@ -247,8 +247,8 @@ public void close() throws IOException { } else { throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()), - MessageFormat.format("Mismatch between {0} hash {1} of uploaded data and ETag {2} returned by the server", - HashAlgorithm.cdash64, cdash64, completedUploadResponse.getCdash64())); + MessageFormat.format("Mismatch between {2} checksum {0} of transfered data and {1} returned by the server", + cdash64, completedUploadResponse.getCdash64(), HashAlgorithm.cdash64)); } } result.set(new EueWriteFeature.Chunk(resourceId, offset, cdash64)); diff --git a/i18n/src/main/resources/ar.lproj/Error.strings b/i18n/src/main/resources/ar.lproj/Error.strings index c191dd82f7245e7df0c823c1df344ed7aed3345c..f6e84722fd748c984d2f085c0c07da995251b133 100644 GIT binary patch delta 140 zcmX>mcS>%<6CU$w1|x=A1_g#>h75*OAeqfj%uvdZ3lynlFaXQsGo%4|B@9Iji41u_ a*)*WKqRITcl9P>i6DZVgwponNfDr(Pv>j^z delta 128 zcmX>lcT8@>6CQ0}1{VfX1_g!;hD3&9AgRDm&0xS#3#9WI(tuh75*OAeqfj%uvdZ3lynlFaXQsGo%4|B@9Iji41u_ a*)*WKqRFy+l9L_y5-8MfwpoSWf)N0-#~u9u delta 168 zcmaE$a7SUoCthz~1{VfX1_g!;hD3&9AgRDm&0xS#3#9WI(tuh75*OAeqfj%uvdZ3lynlFaXQsGo%4|B@9Iji41u_ k*)*WKA|OryilzX?N`P1aESEA_lRug2CR%P55U^kb0Q+nsw*UYD delta 168 zcmX@3bV6yvJw9(=1{VfX1_g!;hD3&9AgRDm&0xS#3#9WI(tule@=cw0BgAqe5g91Y`Lk2@Ckj!Q%W+-LI1&UNN7=UH+8Pb5f5{4p%M20+| aY#LBq(d2Gk$;s<@6DZVgws{ht1tS2PY9D3* delta 168 zcmX>ne@cEs0lkW^r(W-wr=1=9HpX+W}+p@1O=$WCNPVMqmH i1t3mjC;?&xAkG7exH5zQ+3Azl@+MQ$yv?zEg^U3AZXi$q diff --git a/i18n/src/main/resources/da.lproj/Error.strings b/i18n/src/main/resources/da.lproj/Error.strings index a26d5fb3b95631ab71c4b296792cbd951c3c340f..fb158e653fae2f25453e9fbfdba99613234790fd 100644 GIT binary patch delta 72 zcmcbma7SUoC0_Gt1|x=A1_g#>h75*OAeqfj%uvdZ3lynlFaXQsGo%4|B@9Iji41u_ T*)*WKqRD@GB{wVZSup_sj*t-V delta 32 ocmcbka7$ssCEm%C_@o%~C$HsGWKCqqV@R2NkxzNE1)mBN0Lmf?o&W#< diff --git a/i18n/src/main/resources/de.lproj/Error.strings b/i18n/src/main/resources/de.lproj/Error.strings index 5d45d0baab57f7b560c819cd8114ebc8d45293cb..0ab79b1e1f4f7cb39fafa066b5df61ff69bbccab 100644 GIT binary patch delta 72 zcmZou=}_5_!f#&9V8l?%pumvKkin1&B(oWc8A=&)fg;rm24Ih75*OAeqfj%uvdZ3lynlFaXQsGo%4|B@9Iji41u_ S*)*WKqRI07lAE3QQie?opk6t8bJgAqe5g91Y`Lk2@Ckj!Q%W+-LI1&UNN7=UH+8Pb5f5{4p%M20+| kY#LBq5fG;UMN@!cB|xkImP?tulsB2`CR%Rp;j>@_0LiQ*k^lez delta 128 zcmX>he?)#m6tA`~gA0Qxg91YaLn1>lkW^r(W-wr=1=9HpX+W}+p@1O=$WCNPnLLqK XlHHXd1jtUGyqq_gT)msa`3e~U#^xHR diff --git a/i18n/src/main/resources/es.lproj/Error.strings b/i18n/src/main/resources/es.lproj/Error.strings index 9e0dace1a2179ca6b3714a1c11116ad9004b4df0..f64c467a6cb2c37d518aafbac5f6d2874d21fd6a 100644 GIT binary patch delta 72 zcmeBB?o!@xfzP~}!HA)jL4hHeA%h_mNMGn6vq0!6AB48St^3~4}K2}2P>B10Zf SHVvq*X!379$<1>7Sxf+8#t?o0 delta 82 zcmeBD?oi%vfzQ#G!G*z;L4hHIA(5dNNGdQ?GZ-+`0_l8)G$2{ZP{5D_WG6DDFr)&p a0uU!MlmM{;5a%(ZOjZ;S-mJ!-!UO=$co2^O diff --git a/i18n/src/main/resources/et.lproj/Error.strings b/i18n/src/main/resources/et.lproj/Error.strings index 543622d3743b7f0146c861070ba8c33129ab98d7..b4b741a43becbc21ec237a0eb4167efe454e255f 100644 GIT binary patch delta 175 zcmdm^a6nh75*OAeqfj%uvdZ3lynlFaXQsGo%4|B@9Iji41u_ j*)*WKA|OryilzX?N`P1aESEA_k}sL+CR%Rdw_yYTvm_&0 delta 168 zcmX@0ut#CTIbLsH1{VfX1_g!;hD3&9AgRDm&0xS#3#9WI(tu delta 88 zcmX@2ct~+W5TCa%gA0Qxg91YaLn1>lkW^r(W-wr=1=9HpX+W}+p@1O=$WCNPVMqmH c1t3mjC;?&xAkG7exH5zQ+3B0-^Qkfc04-|~ZU6uP diff --git a/i18n/src/main/resources/fr.lproj/Error.strings b/i18n/src/main/resources/fr.lproj/Error.strings index ba6ddf4b858ae7f41649743dd5c5989621446c30..20245a1a1ee7754c7689d776d909adf38194b0d5 100644 GIT binary patch delta 90 zcmbQEJWqMUJwD%R1|x=A1_g#>h75*OAeqfj%uvdZ3lynlFaXQsGo%4|B@9Iji41u_ c*)*WKA|OryilzX?N`P1aESIublfRe=0G>7y{{R30 delta 88 zcmbQIJV$xMJw9(=1{VfX1_g!;hD3&9AgRDm&0xS#3#9WI(tulkW^r(W-wr=1=9HpX+W}+p@1O=$WCNPVMqmH i1t3mjC;?&xAkG7exH5zQ+3A!0d6TJW-sb2UD delta 88 zcmbQGG(%}a6Q8#)gA0Qxg91YaLn1>lkW^r(W-wr=1=9HpX+W}+p@1O=$WCNPVMqmH c1t3mjC;?&xAkG7exH5zQ+3B0l^LaA?03s(5q5uE@ diff --git a/i18n/src/main/resources/hu.lproj/Error.strings b/i18n/src/main/resources/hu.lproj/Error.strings index 3fe11041172055e6c14f3d83e989f00cb8e66082..835ae3eeecef4875b31234ac879b7f1201186255 100644 GIT binary patch delta 90 zcmX@3cusMH6rXQ3gAqe5g91Y`Lk2@Ckj!Q%W+-LI1&UNN7=UH+8Pb5f5{4p%M20+| cY#LBq5fG;UMN@!cB|xkImP^^3%9qXr0Dboo#sB~S delta 56 zcmX@7ct&x96yM}0d;-!64Al$<47Cgj4EYRcK(dsffFTFSPGm@#9LOih?#d7XWT$UV I=Syb-0GM74O8@`> diff --git a/i18n/src/main/resources/it.lproj/Error.strings b/i18n/src/main/resources/it.lproj/Error.strings index 13465e30745e8462e4906ac7d9dc40e7fda6038c..4082f18bf000867563b3cd90faa30d932764464f 100644 GIT binary patch delta 90 zcmaE$^hjyLIX>TN1|x=A1_g#>h75*OAeqfj%uvdZ3lynlFaXQsGo%4|B@9Iji41u_ c*)*WKA|OryilzX?N`P1aESIublHZ*P0LJDMIRF3v delta 88 zcmaE)^gwCDIX-V+1{VfX1_g!;hD3&9AgRDm&0xS#3#9WI(tulkW^r(W-wr=1=9HpX+W}+p@1O=$WCNPnLL|E XlHHXd1jtUGypboFT)mqUd7~Kt!qOU} diff --git a/i18n/src/main/resources/ka.lproj/Error.strings b/i18n/src/main/resources/ka.lproj/Error.strings index b7851992996ec580016894573a6209e3eca3c542..f45e2119bbcdd65955b7eb8db5d0bff0232fa713 100644 GIT binary patch delta 176 zcmX@2a6)0jEneSh1|x=A1_g#>h75*OAeqfj%uvdZ3lynlFaXQsGo%4|B@9Iji41u_ k*)*WKA|OryilzX?N`P1aESEA_l`omh75*OAeqfj%uvdZ3lynlFaXQsGo%4|B@9Iji41u_ c*)*WKA|OryilzX?N`P1aESIv`oM$^D0M;54>;M1& delta 88 zcmew${Z4wr8*Xo31{VfX1_g!;hD3&9AgRDm&0xS#3#9WI(tuh75*OAeqfj%uvdZ3lynlFaXQsGo%4|B@9Iji41u_ T*)*WKqRIPtB{x6f{lo|WeEJdH delta 68 zcmca6e?@-76kcs#1{VfX1_g!;hD3&9AgRDm&0xS#3#9WI(tuQLHH#Aja3V8l?%pumvKkin1&B(oWc8A=&)fg;rm24IZcG42(GWQR delta 82 zcmeBBYE#-!#OLVC;KE?apumv9kjPLBBo!E{84MU|fpk7Y8jvhyC}79|vJ)9n7*c^) a0f-YBN`P1ai1QdyCNJa{-h6`3fe8S%gb^nI diff --git a/i18n/src/main/resources/no.lproj/Error.strings b/i18n/src/main/resources/no.lproj/Error.strings index a4a3f318fb12afa8a3dc17bab398caa0739a0476..954594ce8ee9fea2b5e0ee2d279c28fe724900b8 100644 GIT binary patch delta 176 zcmbQGFi&B_9$w#S1|x=A1_g#>h75*OAeqfj%uvdZ3lynlFaXQsGo%4|B@9Iji41u_ k*)*WKA|OryilzX?N`P1aESEBwoiCZ{CR%QO$EU*x0GMVYz5oCK delta 168 zcmbQIFiT;>9$s%>1{VfX1_g!;hD3&9AgRDm&0xS#3#9WI(tu$V5TBzjgA0Qxg91YaLn1>lkW^r(W-wr=1=9HpX+W}+p@1O=$WCNPVMqmH a1t3mjC;?&xAkJe*nHh75*OAeqfj%uvdZ3lynlFaXQsGo%4|B@9Iji41u_ T*)*WKqRIdHBsVMZJ23$OmM#$( delta 64 zcmaE+^h9aH6+UfW1{VfX1_g!;hD3&9AgRDm&0xS#3#9WI(tuh75*OAeqfj%uvdZ3lynlFaXQsGo%4|B@9Iji41u_ c*)*WKA|OryilzX?N`P1aESIvGnLm&T0Ji)R{{R30 delta 46 zcmcbnbVX^y4!+3+{8EDX3~3As45bVO3^@$>42cXWli%}6vb!>b0NLrAS@{E*07uLW AM*si- diff --git a/i18n/src/main/resources/ro.lproj/Error.strings b/i18n/src/main/resources/ro.lproj/Error.strings index d7a926883732b119a22d9356eb9fcd1bba78947c..3dbdaa66333a4b9bdfed4ddffab53e679c44ae6f 100644 GIT binary patch delta 140 zcmew)|4n{F2d{ZGgAqe5g91Y`Lk2@Ckj!Q%W+-LI1&UNN7=UH+8Pb5f5{4p%M20+| dY#LBq(d0xv$;mBzW|MjNv?wuSa|>S{BLKBl9<%@e delta 128 zcmew+|4DvB2d}m-gA0Qxg91YaLn1>lkW^r(W-wr=1=9HpX+W}+p@1O=$WCNPnY^D@ XlHHXd1jtUGe3dtuT)mrH`3e~UCvzL> diff --git a/i18n/src/main/resources/ru.lproj/Error.strings b/i18n/src/main/resources/ru.lproj/Error.strings index 827b21c2bcd2dcf3fdfb19bddb0679406a067d7f..b0df770dbcf90d0507206d2ca2a4370d856cb1da 100644 GIT binary patch delta 72 zcmX@1cuH}D0-t#`gAqe5g91Y`Lk2@Ckj!Q%W+-LI1&UNN7=UH+8Pb5f5{4p%M20+| SY#LBq(PVEv$<29uQA_|*yARm_ delta 88 zcmX@5ctUZ50-v`pgA0Qxg91YaLn1>lkW^r(W-wr=1=9HpX+W}+p@1O=$WCNPVMqmH b1t3mjC;?&xAkG7exH5zQ+3A~e`C^#>An_4S diff --git a/i18n/src/main/resources/sk.lproj/Error.strings b/i18n/src/main/resources/sk.lproj/Error.strings index 28a868fa0c0c8290ba044529b7ee70bb9539be34..058ef77936219f92d9437f0a2c218c111089dae7 100644 GIT binary patch delta 90 zcmcbo@IYb1KVIKz1|x=A1_g#>h75*OAeqfj%uvdZ3lynlFaXQsGo%4|B@9Iji41u_ c*)*WKA|OryilzX?N`P1aESIv`lTVZh0Mr)~T>t<8 delta 88 zcmaE$a8F^wKVENN1{VfX1_g!;hD3&9AgRDm&0xS#3#9WI(tui_@% diff --git a/i18n/src/main/resources/sl.lproj/Error.strings b/i18n/src/main/resources/sl.lproj/Error.strings index 3142d78b1d838bfac15e37bc0531043c8741e419..64c95fcf255e0280b9e96d3ed61543f4f5a14ded 100644 GIT binary patch delta 140 zcmdm^ctCMO5TAK9gAqe5g91Y`Lk2@Ckj!Q%W+-LI1&UNN7=UH+8Pb5f5{4p%M20+| aY#LBq(d1e_$;k`&5-8Mfwz-Ahf)N0I!5;ts delta 168 zcmX@0xJPkA5TCa%gA0Qxg91YaLn1>lkW^r(W-wr=1=9HpX+W}+p@1O=$WCNPVMqmH i1t3mjC;?&xAkG7exH5zQ+3Az#^CeT$yv_dng^U2(03ZlkW^r(W-wr=1=9HpX+W}+p@1O=$WCNPncU4M X$?nP!0%WI8UdWeBuHMao{MC#A$6gwx diff --git a/i18n/src/main/resources/sv.lproj/Error.strings b/i18n/src/main/resources/sv.lproj/Error.strings index 57e659c6566bc585d6277ec34eb20263dcb20547..0e4ac82a0793e191e1ff21c0effaa36fd03fa990 100644 GIT binary patch delta 72 zcmX@3a86;vBVO}r1|x=A1_g#>h75*OAeqfj%uvdZ3lynlFaXQsGo%4|B@9Iji41u_ S*)*WKqRG5`lA8_qWS9VhhY#ie delta 66 zcmX@7a7JOnBi_jcd{Tz_3~3As45bVO3^@$>42cXW45>h@0K|z5B|xkI#Cc#5SB4NE LJAJc0pF9%)KPwKn diff --git a/i18n/src/main/resources/ta_IN.lproj/Error.strings b/i18n/src/main/resources/ta_IN.lproj/Error.strings index fb09a3667b124bb81683683add58d0e3320f741c..94e3b43175d050d5c7a74d5aa49a6332487c4571 100644 GIT binary patch delta 72 zcmX@1cuH}D5TAK9gAqe5g91Y`Lk2@Ckj!Q%W+-LI1&UNN7=UH+8Pb5f5{4p%M20+| SY#LBq(PUdb$;}CT8B739g%7;| delta 88 zcmX@5ctUZ55TCa%gA0Qxg91YaLn1>lkW^r(W-wr=1=9HpX+W}+p@1O=$WCNPVMqmH b1t3mjC;?&xAkG7exH5zQ+3B0(`LdY+97_>E diff --git a/i18n/src/main/resources/th.lproj/Error.strings b/i18n/src/main/resources/th.lproj/Error.strings index d3f6d5d911717858c534a190a5c16bc424fb4712..d33bc9f48b3833483ae69d3eb6f84841959a67f9 100644 GIT binary patch delta 176 zcmX>he@1>o9ItORgAqe5g91Y`Lk2@Ckj!Q%W+-LI1&UNN7=UH+8Pb5f5{4p%M20+| kY#LBq5fG;UMN@!cB|xkImP?tuk~f*^CR%Quz-Pe-0MlqBssI20 delta 168 zcmX>je?opk9Iv-8gA0Qxg91YaLn1>lkW^r(W-wr=1=9HpX+W}+p@1O=$WCNPVMqmH i1t3mjC;?&xAkG7exH5zQ+3Ay4^CnZ%yv@;kg^U35+#p5( diff --git a/i18n/src/main/resources/tr.lproj/Error.strings b/i18n/src/main/resources/tr.lproj/Error.strings index c6a41c5fa57bbdfd237a8d56b4b610637f97d6d4..9583499375513f8814f3950f1365e4572633ec98 100644 GIT binary patch delta 72 zcmeBEn4qwsiPyZE!HA)jL4hHeA%h_mNMGn6vq0!6AB48St^3~4}K2}2P>B10Zf SHVvq*X!2TK$;}sd?U(>hy%1^u delta 88 zcmbQB(5JAWiPzhg!G*z;L4hHIA(5dNNGdQ?GZ-+`0_l8)G$2{ZP{5D_WG6DDFr)&p b0uU!MlmM{;5a)qKTp2=u?DWm&c^#Pm8JZD( diff --git a/i18n/src/main/resources/uk.lproj/Error.strings b/i18n/src/main/resources/uk.lproj/Error.strings index 1ce8ac18ec237f9d8bc38e3bbd9dc5d90a81830e..3daeba74c971bd6689838f27c4fee7f3ee27d480 100644 GIT binary patch delta 72 zcmZ3Wut;IU7GCpe1|x=A1_g#>h75*OAeqfj%uvdZ3lynlFaXQsGo%4|B@9Iji41u_ T*)*WKqRIDpB{wti$uR){Wa=Vb4txLr diff --git a/i18n/src/main/resources/zh_CN.lproj/Error.strings b/i18n/src/main/resources/zh_CN.lproj/Error.strings index 6649c2bf610fa386ce247a2da82d0f03d2f33d0d..b55af232bb9572ee8e139100f875a8f83e6f2c98 100644 GIT binary patch delta 90 zcmew-(IB~DAD3@6gAqe5g91Y`Lk2@Ckj!Q%W+-LI1&UNN7=UH+8Pb5f5{4p%M20+| cY#LBq5fG;UMN@!cB|xkImP^^p$z93_0HUZ8=Kufz delta 83 zcmZpW{3o$tAD5FagA0Qxg91YaLn1>lkW^r(W-wr=1=9HpX+W}+p@1O=$WCNPVMqmH a1t3mjC;?&xAkG8wCO2@4Y!>6rVgvy6j1e6G diff --git a/i18n/src/main/resources/zh_TW.lproj/Error.strings b/i18n/src/main/resources/zh_TW.lproj/Error.strings index b80c9097b8d5731aaf917355e8237ce946e80f6a..7c71073bd3f64cd4d2f3850eccddf8e833c6caac 100644 GIT binary patch delta 175 zcmbOrHAQN}FD~C|1|x=A1_g#>h75*OAeqfj%uvdZ3lynlFaXQsGo%4|B@9Iji41u_ j*)*WKA|OryilzX?N`P1aESECbl{=a0CR$F`;duf8nmHsQ delta 128 zcmbOtH9=~_FD`9g1{VfX1_g!;hD3&9AgRDm&0xS#3#9WI(tu write, final Path file, final Local local, final Checksum expected = ChecksumComputeFactory.get(fingerprint.algorithm).compute(local.getInputStream(), new TransferStatus(status)); if(!expected.equals(fingerprint)) { throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()), - MessageFormat.format("Mismatch between {0} hash {1} of transfered data and {2} returned by the server", - fingerprint.algorithm.toString(), expected, fingerprint.hash)); + MessageFormat.format("Mismatch between {2} checksum {0} of transfered data and {1} returned by the server", + expected, fingerprint.hash, fingerprint.algorithm)); } } } diff --git a/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartUploadService.java b/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartUploadService.java index 659ec2c8c61..9e0ea1f642d 100644 --- a/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartUploadService.java +++ b/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartUploadService.java @@ -183,7 +183,7 @@ public StorageObject upload(final Write write, final Path file, f if(!StringUtils.equalsIgnoreCase(expected, reference)) { throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()), MessageFormat.format("Mismatch between {2} checksum {0} of transfered data and {1} returned by the server", - expected, reference)); + expected, reference, HashAlgorithm.md5)); } } } diff --git a/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartWriteFeature.java b/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartWriteFeature.java index 14a8e433394..c2cbe67c973 100644 --- a/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartWriteFeature.java +++ b/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartWriteFeature.java @@ -209,7 +209,7 @@ public void close() throws IOException { if(!StringUtils.equalsIgnoreCase(expected, reference)) { throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()), MessageFormat.format("Mismatch between {2} checksum {0} of transfered data and {1} returned by the server", - expected, reference)); + expected, reference, HashAlgorithm.md5)); } } } From af44fa179c9256ac3a83d3e2f9396f2af969aa4a Mon Sep 17 00:00:00 2001 From: David Kocher Date: Thu, 20 Nov 2025 17:52:08 +0100 Subject: [PATCH 3/7] Set checksum from filter stream after upload. --- .../worker/B2ConcurrentTransferWorkerTest.java | 2 +- .../core/worker/B2SingleTransferWorkerTest.java | 11 ++--------- .../core/shared/DefaultUploadFeature.java | 15 ++++++++++++--- .../core/dropbox/DropboxUploadFeatureTest.java | 7 ++++--- .../worker/SwiftSingleTransferWorkerTest.java | 11 ++--------- .../core/worker/S3SingleTransferWorkerTest.java | 4 ++-- 6 files changed, 23 insertions(+), 27 deletions(-) diff --git a/backblaze/src/test/java/ch/cyberduck/core/worker/B2ConcurrentTransferWorkerTest.java b/backblaze/src/test/java/ch/cyberduck/core/worker/B2ConcurrentTransferWorkerTest.java index 9bc5b3d8ffe..d216d8ea850 100644 --- a/backblaze/src/test/java/ch/cyberduck/core/worker/B2ConcurrentTransferWorkerTest.java +++ b/backblaze/src/test/java/ch/cyberduck/core/worker/B2ConcurrentTransferWorkerTest.java @@ -113,7 +113,7 @@ public Session create() { final B2LargeUploadService upload = new B2LargeUploadService(this, new B2VersionIdProvider(this) ) { @Override - protected InputStream decorate(final InputStream in, final UploadFilterOptions options) { + protected InputStream decorate(final InputStream in, final TransferStatus status, final UploadFilterOptions options) { if(failed.get()) { // Second attempt successful return in; diff --git a/backblaze/src/test/java/ch/cyberduck/core/worker/B2SingleTransferWorkerTest.java b/backblaze/src/test/java/ch/cyberduck/core/worker/B2SingleTransferWorkerTest.java index 4433504b3ac..b9649b8720a 100644 --- a/backblaze/src/test/java/ch/cyberduck/core/worker/B2SingleTransferWorkerTest.java +++ b/backblaze/src/test/java/ch/cyberduck/core/worker/B2SingleTransferWorkerTest.java @@ -41,14 +41,7 @@ import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader; import ch.cyberduck.core.ssl.DefaultX509KeyManager; import ch.cyberduck.core.ssl.DefaultX509TrustManager; -import ch.cyberduck.core.transfer.DisabledTransferErrorCallback; -import ch.cyberduck.core.transfer.DisabledTransferPrompt; -import ch.cyberduck.core.transfer.Transfer; -import ch.cyberduck.core.transfer.TransferAction; -import ch.cyberduck.core.transfer.TransferItem; -import ch.cyberduck.core.transfer.TransferOptions; -import ch.cyberduck.core.transfer.TransferSpeedometer; -import ch.cyberduck.core.transfer.UploadTransfer; +import ch.cyberduck.core.transfer.*; import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import ch.cyberduck.test.VaultTest; @@ -110,7 +103,7 @@ public String getProperty(final String key) { final B2LargeUploadService upload = new B2LargeUploadService(this, new B2VersionIdProvider(this) ) { @Override - protected InputStream decorate(final InputStream in, final UploadFilterOptions options) { + protected InputStream decorate(final InputStream in, final TransferStatus status, final UploadFilterOptions options) { if(failed.get()) { // Second attempt successful return in; diff --git a/core/src/main/java/ch/cyberduck/core/shared/DefaultUploadFeature.java b/core/src/main/java/ch/cyberduck/core/shared/DefaultUploadFeature.java index 18d0fa1b093..b17127dad77 100644 --- a/core/src/main/java/ch/cyberduck/core/shared/DefaultUploadFeature.java +++ b/core/src/main/java/ch/cyberduck/core/shared/DefaultUploadFeature.java @@ -27,6 +27,7 @@ import ch.cyberduck.core.features.Upload; import ch.cyberduck.core.features.Write; import ch.cyberduck.core.io.BandwidthThrottle; +import ch.cyberduck.core.io.Checksum; import ch.cyberduck.core.io.StatusOutputStream; import ch.cyberduck.core.io.StreamCancelation; import ch.cyberduck.core.io.StreamCopier; @@ -36,6 +37,7 @@ import ch.cyberduck.core.transfer.TransferStatus; import ch.cyberduck.core.transfer.upload.UploadFilterOptions; +import org.apache.commons.codec.binary.Hex; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -59,7 +61,7 @@ public Reply upload(final Write write, final Path file, final Local local protected Reply transfer(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final StreamCancelation cancel, final StreamProgress progress, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { - final InputStream in = this.decorate(local.getInputStream(), options); + final InputStream in = this.decorate(local.getInputStream(), status, options); final StatusOutputStream out = write.write(file, status, callback); new StreamCopier(cancel, progress) .withOffset(status.getOffset()) @@ -73,10 +75,11 @@ protected Reply transfer(final Write write, final Path file, final Local * Wrap input stream if checksum calculation is enabled. * * @param in File input stream + * @param status * @param options * @return Wrapped or same stream */ - protected InputStream decorate(final InputStream in, final UploadFilterOptions options) throws BackgroundException { + protected InputStream decorate(final InputStream in, final TransferStatus status, final UploadFilterOptions options) throws BackgroundException { if(options.checksum) { final MessageDigest digest; try { @@ -86,7 +89,13 @@ protected InputStream decorate(final InputStream in, final UploadFilterOptions o throw new DefaultIOExceptionMappingService().map(e); } if(null != digest) { - return new DigestInputStream(in, digest); + return new DigestInputStream(in, digest) { + @Override + public void close() throws IOException { + super.close(); + status.setChecksum(Checksum.parse(Hex.encodeHexString(digest.digest()))); + } + }; } } return in; diff --git a/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxUploadFeatureTest.java b/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxUploadFeatureTest.java index 12ef049a86e..69009754fab 100644 --- a/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxUploadFeatureTest.java +++ b/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxUploadFeatureTest.java @@ -26,6 +26,7 @@ import ch.cyberduck.core.exception.BackgroundException; import ch.cyberduck.core.features.Delete; import ch.cyberduck.core.io.BandwidthThrottle; +import ch.cyberduck.core.transfer.Transfer; import ch.cyberduck.core.transfer.TransferStatus; import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; @@ -81,9 +82,9 @@ public void testDecorate() throws Exception { final NullInputStream n = new NullInputStream(1L); assertSame(NullInputStream.class, new DropboxUploadFeature() { @Override - protected InputStream decorate(final InputStream in, final UploadFilterOptions options) throws BackgroundException { - return super.decorate(in, options); + protected InputStream decorate(final InputStream in, final TransferStatus status, final UploadFilterOptions options) throws BackgroundException { + return super.decorate(in, status, options); } - }.decorate(n, new UploadFilterOptions(session.getHost())).getClass()); + }.decorate(n, new TransferStatus(), new UploadFilterOptions(session.getHost())).getClass()); } } \ No newline at end of file diff --git a/openstack/src/test/java/ch/cyberduck/core/worker/SwiftSingleTransferWorkerTest.java b/openstack/src/test/java/ch/cyberduck/core/worker/SwiftSingleTransferWorkerTest.java index f277b76a6d9..0aaa74d18b7 100644 --- a/openstack/src/test/java/ch/cyberduck/core/worker/SwiftSingleTransferWorkerTest.java +++ b/openstack/src/test/java/ch/cyberduck/core/worker/SwiftSingleTransferWorkerTest.java @@ -38,14 +38,7 @@ import ch.cyberduck.core.openstack.SwiftSession; import ch.cyberduck.core.ssl.DefaultX509KeyManager; import ch.cyberduck.core.ssl.DisabledX509TrustManager; -import ch.cyberduck.core.transfer.DisabledTransferErrorCallback; -import ch.cyberduck.core.transfer.DisabledTransferPrompt; -import ch.cyberduck.core.transfer.Transfer; -import ch.cyberduck.core.transfer.TransferAction; -import ch.cyberduck.core.transfer.TransferItem; -import ch.cyberduck.core.transfer.TransferOptions; -import ch.cyberduck.core.transfer.TransferSpeedometer; -import ch.cyberduck.core.transfer.UploadTransfer; +import ch.cyberduck.core.transfer.*; import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import ch.cyberduck.test.VaultTest; @@ -101,7 +94,7 @@ public T _getFeature(final Class type) { final SwiftRegionService regionService = new SwiftRegionService(this); return (T) new SwiftLargeObjectUploadFeature(this, regionService, 1024L * 1024L, 5) { @Override - protected InputStream decorate(final InputStream in, final UploadFilterOptions options) { + protected InputStream decorate(final InputStream in, final TransferStatus status, final UploadFilterOptions options) { if(failed.get()) { // Second attempt successful return in; diff --git a/s3/src/test/java/ch/cyberduck/core/worker/S3SingleTransferWorkerTest.java b/s3/src/test/java/ch/cyberduck/core/worker/S3SingleTransferWorkerTest.java index baa4585f606..da91acdcb6c 100644 --- a/s3/src/test/java/ch/cyberduck/core/worker/S3SingleTransferWorkerTest.java +++ b/s3/src/test/java/ch/cyberduck/core/worker/S3SingleTransferWorkerTest.java @@ -147,7 +147,7 @@ public T _getFeature(final Class type) { if(type == Upload.class) { return (T) new S3MultipartUploadService(this, new S3AccessControlListFeature(this), 5 * 1024L * 1024L, 5) { @Override - protected InputStream decorate(final InputStream in, final UploadFilterOptions options) { + protected InputStream decorate(final InputStream in, final TransferStatus status, final UploadFilterOptions options) { if(failed.get()) { // Second attempt successful return in; @@ -225,7 +225,7 @@ public T _getFeature(final Class type) { if(type == Upload.class) { return (T) new S3SingleUploadService(this) { @Override - protected InputStream decorate(final InputStream in, final UploadFilterOptions options) { + protected InputStream decorate(final InputStream in, final TransferStatus status, final UploadFilterOptions options) { if(failed.get()) { // Second attempt successful return in; From 7f179a0c01ad4fe5d5cb54d514860a1ebaf1c6e7 Mon Sep 17 00:00:00 2001 From: David Kocher Date: Thu, 20 Nov 2025 17:54:03 +0100 Subject: [PATCH 4/7] Drop support for stream based checksum calculation. --- .../core/b2/B2SingleUploadService.java | 13 --------- .../core/shared/DefaultUploadFeature.java | 28 ------------------- .../core/dropbox/DropboxUploadFeature.java | 13 --------- .../SwiftSmallObjectUploadFeature.java | 13 --------- .../core/s3/S3SingleUploadService.java | 13 --------- 5 files changed, 80 deletions(-) diff --git a/backblaze/src/main/java/ch/cyberduck/core/b2/B2SingleUploadService.java b/backblaze/src/main/java/ch/cyberduck/core/b2/B2SingleUploadService.java index 77811bc874f..97872fbdc7c 100644 --- a/backblaze/src/main/java/ch/cyberduck/core/b2/B2SingleUploadService.java +++ b/backblaze/src/main/java/ch/cyberduck/core/b2/B2SingleUploadService.java @@ -17,21 +17,8 @@ import ch.cyberduck.core.http.HttpUploadFeature; -import java.io.IOException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - import synapticloop.b2.response.BaseB2Response; public class B2SingleUploadService extends HttpUploadFeature { - @Override - protected MessageDigest digest() throws IOException { - try { - return MessageDigest.getInstance("SHA1"); - } - catch(NoSuchAlgorithmException e) { - throw new IOException(e.getMessage(), e); - } - } } diff --git a/core/src/main/java/ch/cyberduck/core/shared/DefaultUploadFeature.java b/core/src/main/java/ch/cyberduck/core/shared/DefaultUploadFeature.java index b17127dad77..6ed5595da11 100644 --- a/core/src/main/java/ch/cyberduck/core/shared/DefaultUploadFeature.java +++ b/core/src/main/java/ch/cyberduck/core/shared/DefaultUploadFeature.java @@ -19,7 +19,6 @@ */ import ch.cyberduck.core.ConnectionCallback; -import ch.cyberduck.core.DefaultIOExceptionMappingService; import ch.cyberduck.core.Local; import ch.cyberduck.core.Path; import ch.cyberduck.core.ProgressListener; @@ -27,7 +26,6 @@ import ch.cyberduck.core.features.Upload; import ch.cyberduck.core.features.Write; import ch.cyberduck.core.io.BandwidthThrottle; -import ch.cyberduck.core.io.Checksum; import ch.cyberduck.core.io.StatusOutputStream; import ch.cyberduck.core.io.StreamCancelation; import ch.cyberduck.core.io.StreamCopier; @@ -37,14 +35,10 @@ import ch.cyberduck.core.transfer.TransferStatus; import ch.cyberduck.core.transfer.upload.UploadFilterOptions; -import org.apache.commons.codec.binary.Hex; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.io.IOException; import java.io.InputStream; -import java.security.DigestInputStream; -import java.security.MessageDigest; public class DefaultUploadFeature implements Upload { private static final Logger log = LogManager.getLogger(DefaultUploadFeature.class); @@ -80,28 +74,6 @@ protected Reply transfer(final Write write, final Path file, final Local * @return Wrapped or same stream */ protected InputStream decorate(final InputStream in, final TransferStatus status, final UploadFilterOptions options) throws BackgroundException { - if(options.checksum) { - final MessageDigest digest; - try { - digest = this.digest(); - } - catch(IOException e) { - throw new DefaultIOExceptionMappingService().map(e); - } - if(null != digest) { - return new DigestInputStream(in, digest) { - @Override - public void close() throws IOException { - super.close(); - status.setChecksum(Checksum.parse(Hex.encodeHexString(digest.digest()))); - } - }; - } - } return in; } - - protected MessageDigest digest() throws IOException { - return null; - } } diff --git a/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxUploadFeature.java b/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxUploadFeature.java index 1ea9b170de0..5681ee5a41c 100644 --- a/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxUploadFeature.java +++ b/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxUploadFeature.java @@ -18,21 +18,8 @@ import ch.cyberduck.core.http.HttpUploadFeature; -import java.io.IOException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - import com.dropbox.core.v2.files.Metadata; public class DropboxUploadFeature extends HttpUploadFeature { - @Override - protected MessageDigest digest() throws IOException { - try { - return new DropboxContentHasher(MessageDigest.getInstance("SHA-256"), MessageDigest.getInstance("SHA-256"), 0); - } - catch(NoSuchAlgorithmException e) { - throw new IOException(e.getMessage(), e); - } - } } diff --git a/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftSmallObjectUploadFeature.java b/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftSmallObjectUploadFeature.java index 71dd89dc10a..1e3ea35f71e 100644 --- a/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftSmallObjectUploadFeature.java +++ b/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftSmallObjectUploadFeature.java @@ -19,21 +19,8 @@ import ch.cyberduck.core.http.HttpUploadFeature; -import java.io.IOException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - import ch.iterate.openstack.swift.model.StorageObject; public class SwiftSmallObjectUploadFeature extends HttpUploadFeature { - @Override - protected MessageDigest digest() throws IOException { - try { - return MessageDigest.getInstance("MD5"); - } - catch(NoSuchAlgorithmException e) { - throw new IOException(e.getMessage(), e); - } - } } diff --git a/s3/src/main/java/ch/cyberduck/core/s3/S3SingleUploadService.java b/s3/src/main/java/ch/cyberduck/core/s3/S3SingleUploadService.java index 53b2e7a7ad3..b27a5814b2e 100644 --- a/s3/src/main/java/ch/cyberduck/core/s3/S3SingleUploadService.java +++ b/s3/src/main/java/ch/cyberduck/core/s3/S3SingleUploadService.java @@ -37,10 +37,6 @@ import org.apache.logging.log4j.Logger; import org.jets3t.service.model.StorageObject; -import java.io.IOException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - public class S3SingleUploadService extends HttpUploadFeature { private static final Logger log = LogManager.getLogger(S3SingleUploadService.class); @@ -80,13 +76,4 @@ public StorageObject upload(final Write write, final Path file, f } } - @Override - protected MessageDigest digest() throws IOException { - try { - return MessageDigest.getInstance("MD5"); - } - catch(NoSuchAlgorithmException e) { - throw new IOException(e.getMessage(), e); - } - } } From f53809aab3d4ea67189427826dac29d9c5ee7fff Mon Sep 17 00:00:00 2001 From: David Kocher Date: Thu, 20 Nov 2025 17:56:15 +0100 Subject: [PATCH 5/7] Fix #17352. --- .../ch/cyberduck/core/googledrive/DriveWriteFeature.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveWriteFeature.java b/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveWriteFeature.java index 5a192222f27..896ad5f8fae 100644 --- a/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveWriteFeature.java +++ b/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveWriteFeature.java @@ -24,6 +24,9 @@ import ch.cyberduck.core.http.DefaultHttpResponseExceptionMappingService; import ch.cyberduck.core.http.DelayedHttpEntityCallable; import ch.cyberduck.core.http.HttpResponseOutputStream; +import ch.cyberduck.core.io.ChecksumCompute; +import ch.cyberduck.core.io.ChecksumComputeFactory; +import ch.cyberduck.core.io.HashAlgorithm; import ch.cyberduck.core.preferences.HostPreferencesFactory; import ch.cyberduck.core.transfer.TransferStatus; @@ -181,4 +184,9 @@ public long getContentLength() { }; return this.write(file, status, command); } + + @Override + public ChecksumCompute checksum(final Path file, final TransferStatus status) { + return ChecksumComputeFactory.get(HashAlgorithm.md5); + } } From 07dd3dc6534f618d0ca4f1350a594513fce75962 Mon Sep 17 00:00:00 2001 From: David Kocher Date: Tue, 2 Dec 2025 18:23:49 +0100 Subject: [PATCH 6/7] Revert "Generalize checksum validation for uploads by comparing with attributes from server." This reverts commit 07f53e5795c77df287e3bb9f35598028a83645d2. --- .../core/b2/B2LargeUploadService.java | 14 ++++----- .../core/b2/B2ThresholdUploadService.java | 8 ++--- .../core/b2/B2LargeUploadServiceTest.java | 19 ++++++------ .../cyberduck/core/b2/B2ReadFeatureTest.java | 5 ++-- .../core/b2/B2SingleUploadServiceTest.java | 3 +- .../cryptomator/B2LargeUploadServiceTest.java | 5 ++-- .../B2ConcurrentTransferWorkerTest.java | 3 +- .../worker/B2SingleTransferWorkerTest.java | 13 +++++++-- .../core/box/BoxLargeUploadService.java | 10 +++---- .../core/box/BoxThresholdUploadService.java | 7 ++--- .../core/box/BoxLargeUploadServiceTest.java | 3 +- .../BoxThresholdUploadServiceTest.java | 3 +- .../brick/BrickThresholdUploadFeature.java | 5 ++-- .../core/brick/BrickUploadFeature.java | 10 +++---- .../core/brick/BrickCopyFeatureTest.java | 7 ++--- .../core/brick/BrickDeleteFeatureTest.java | 3 +- .../core/brick/BrickLockFeatureTest.java | 3 +- .../core/brick/BrickMoveFeatureTest.java | 3 +- .../core/brick/BrickReadFeatureTest.java | 5 ++-- .../BrickThresholdUploadFeatureTest.java | 5 ++-- .../core/brick/BrickUploadFeatureTest.java | 7 ++--- .../cyberduck/core/worker/CopyWorkerTest.java | 7 ++--- .../ch/cyberduck/core/features/Upload.java | 4 +-- .../core/shared/DefaultUploadFeature.java | 14 ++++----- .../core/transfer/UploadTransfer.java | 2 +- .../registry/VaultRegistryUploadFeature.java | 5 ++-- .../ch/cyberduck/core/NullUploadFeature.java | 3 +- .../features/CryptoUploadFeature.java | 5 ++-- .../CteraConcurrentTransferWorkerTest.java | 5 ++-- .../ctera/CteraDirectIOReadFeatureTest.java | 3 +- .../core/ctera/CteraReadFeatureTest.java | 7 ++--- .../core/ctera/CteraWriteFeatureTest.java | 7 ++--- .../core/sds/SDSDirectS3UploadFeature.java | 12 ++++---- .../core/sds/SDSDeleteFeatureTest.java | 3 +- .../sds/SDSDirectS3UploadFeatureTest.java | 19 ++++++------ .../core/sds/SDSReadFeatureTest.java | 5 ++-- .../core/dropbox/DropboxReadFeatureTest.java | 3 +- .../dropbox/DropboxUploadFeatureTest.java | 10 +++---- .../core/eue/EueLargeUploadService.java | 6 ++-- .../core/eue/EueSingleUploadService.java | 5 ++-- .../core/eue/EueThresholdUploadService.java | 9 +++--- .../EueSingleUploadServiceTest.java | 3 +- .../EueThresholdUploadServiceTest.java | 5 ++-- .../cryptomator/EueUploadServiceTest.java | 5 ++-- .../core/eue/EueCopyFeatureTest.java | 3 +- .../core/eue/EueLargeUploadServiceTest.java | 3 +- .../core/eue/EueSingleUploadServiceTest.java | 5 ++-- .../eue/EueThresholdUploadServiceTest.java | 5 ++-- .../core/eue/EueUploadServiceTest.java | 3 +- .../core/shared/DefaultUploadFeatureTest.java | 5 ++-- .../googledrive/DriveReadFeatureTest.java | 3 +- .../googledrive/DriveUploadFeatureTest.java | 3 +- .../DefaultUploadFeatureTest.java | 3 +- .../core/irods/IRODSUploadFeature.java | 4 +-- .../core/irods/IRODSReadFeatureTest.java | 3 +- .../core/irods/IRODSUploadFeatureTest.java | 9 +++--- .../core/manta/MantaReadFeatureTest.java | 5 ++-- .../core/onedrive/GraphReadFeatureTest.java | 5 ++-- .../SwiftLargeObjectUploadFeature.java | 10 +++---- .../SwiftThresholdUploadService.java | 6 ++-- .../SwiftLargeObjectUploadFeatureTest.java | 5 ++-- .../SwiftLargeObjectUploadFeatureTest.java | 17 +++++------ .../worker/SwiftSingleTransferWorkerTest.java | 13 +++++++-- .../cryptomator/OcisUploadFeatureTest.java | 3 +- .../core/owncloud/OcisUploadFeatureTest.java | 5 ++-- .../core/s3/S3MultipartUploadService.java | 10 +++---- .../core/s3/S3SingleUploadService.java | 8 ++--- .../core/s3/S3ThresholdUploadService.java | 10 +++---- .../S3MultipartUploadServiceTest.java | 7 ++--- .../S3SingleUploadServiceTest.java | 3 +- .../core/s3/S3MultipartUploadServiceTest.java | 29 +++++++++---------- .../core/s3/S3SingleUploadServiceTest.java | 12 ++++---- .../core/s3/S3ThresholdUploadServiceTest.java | 9 +++--- .../worker/S3SingleTransferWorkerTest.java | 5 ++-- .../core/spectra/SpectraUploadFeature.java | 6 ++-- .../spectra/SpectraUploadFeatureTest.java | 7 ++--- .../core/shared/DefaultUploadFeatureTest.java | 5 ++-- .../storegate/StoregateReadFeatureTest.java | 5 ++-- .../cyberduck/core/tus/TusUploadFeature.java | 10 +++---- .../core/dav/DAVLockFeatureTest.java | 3 +- .../core/dav/DAVReadFeatureTest.java | 7 ++--- .../core/dav/DAVUploadFeatureTest.java | 7 ++--- .../core/dav/DAVWriteFeatureTest.java | 9 +++--- .../MicrosoftIISDAVLockFeatureTest.java | 3 +- .../MicrosoftIISDAVReadFeatureTest.java | 3 +- .../MicrosoftIISDAVUploadFeatureTest.java | 7 ++--- .../DAVConcurrentTransferWorkerTest.java | 9 +++--- .../worker/DAVSingleTransferWorkerTest.java | 5 ++-- 88 files changed, 249 insertions(+), 336 deletions(-) diff --git a/backblaze/src/main/java/ch/cyberduck/core/b2/B2LargeUploadService.java b/backblaze/src/main/java/ch/cyberduck/core/b2/B2LargeUploadService.java index 5663f1086ff..3bfcd6dc1d8 100644 --- a/backblaze/src/main/java/ch/cyberduck/core/b2/B2LargeUploadService.java +++ b/backblaze/src/main/java/ch/cyberduck/core/b2/B2LargeUploadService.java @@ -39,8 +39,6 @@ import ch.cyberduck.core.transfer.SegmentRetryCallable; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; - import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -94,7 +92,7 @@ public B2LargeUploadService(final B2Session session, final B2VersionIdProvider f @Override public BaseB2Response upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, - final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { final long partSize; if(file.getType().contains(Path.Type.encrypted)) { // For uploads to vault part size must be a multiple of 32 * 1024. Recommended partsize from B2 API may not meet that requirement. @@ -104,12 +102,12 @@ public BaseB2Response upload(final Write write, final Path file, partSize = this.partSize; } return this.upload(write, file, local, throttle, progress, streamListener, status, callback, - partSize < status.getLength() ? partSize : PreferencesFactory.get().getLong("b2.upload.largeobject.size.minimum"), options); + partSize < status.getLength() ? partSize : PreferencesFactory.get().getLong("b2.upload.largeobject.size.minimum")); } public BaseB2Response upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, - final ConnectionCallback callback, final Long partSize, final UploadFilterOptions options) throws BackgroundException { + final ConnectionCallback callback, final Long partSize) throws BackgroundException { final ThreadPool pool = ThreadPoolFactory.get("largeupload", concurrency); try { // Get the results of the uploads in the order they were submitted @@ -171,7 +169,7 @@ public BaseB2Response upload(final Write write, final Path file, if(!skip) { final long length = Math.min(Math.max((size / B2LargeUploadService.MAXIMUM_UPLOAD_PARTS), partSize), remaining); // Submit to queue - parts.add(this.submit(pool, write, file, local, throttle, streamListener, status, fileId, partNumber, offset, length, callback, options)); + parts.add(this.submit(pool, write, file, local, throttle, streamListener, status, fileId, partNumber, offset, length, callback)); log.debug("Part {} submitted with size {} and offset {}", partNumber, length, offset); remaining -= length; offset += length; @@ -212,7 +210,7 @@ private Future submit(final ThreadPool pool, final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { if(this.threshold(status)) { - return new B2LargeUploadService(session, fileid).upload(write, file, local, throttle, progress, streamListener, status, callback, options); + return new B2LargeUploadService(session, fileid).upload(write, file, local, throttle, progress, streamListener, status, callback); } else { - return new B2SingleUploadService().upload(write, file, local, throttle, progress, streamListener, status, callback, options); + return new B2SingleUploadService().upload(write, file, local, throttle, progress, streamListener, status, callback); } } diff --git a/backblaze/src/test/java/ch/cyberduck/core/b2/B2LargeUploadServiceTest.java b/backblaze/src/test/java/ch/cyberduck/core/b2/B2LargeUploadServiceTest.java index 7e2687a50e7..054ec8cc8ac 100644 --- a/backblaze/src/test/java/ch/cyberduck/core/b2/B2LargeUploadServiceTest.java +++ b/backblaze/src/test/java/ch/cyberduck/core/b2/B2LargeUploadServiceTest.java @@ -38,7 +38,6 @@ import ch.cyberduck.core.io.StreamProgress; import ch.cyberduck.core.shared.DefaultFindFeature; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -84,7 +83,7 @@ public void testUpload() throws Exception { final B2LargeUploadService upload = new B2LargeUploadService(session, fileid, 5 * 1000L * 1000L, 5); upload.upload(new B2WriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), - status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + status, new DisabledConnectionCallback()); final PathAttributes attr = new B2AttributesFinderFeature(session, fileid).find(test); assertNotEquals(Checksum.NONE, attr.getChecksum()); assertEquals(checksum, attr.getChecksum()); @@ -119,15 +118,15 @@ public void testAppendNoPartCompleted() throws Exception { final B2VersionIdProvider fileid = new B2VersionIdProvider(session); final B2LargeUploadService service = new B2LargeUploadService(session, fileid, 5 * 1000L * 1000L, 1) { @Override - public BaseB2Response transfer(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final StreamCancelation cancel, final StreamProgress progress, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + public BaseB2Response transfer(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final StreamCancelation cancel, final StreamProgress progress, final ConnectionCallback callback) throws BackgroundException { if(!interrupt.get()) { throw new ConnectionTimeoutException("Test"); } - return super.transfer(write, file, local, throttle, listener, status, cancel, progress, callback, options); + return super.transfer(write, file, local, throttle, listener, status, cancel, progress, callback); } }; try { - service.upload(new B2WriteFeature(session, fileid), test, new Local(System.getProperty("java.io.tmpdir"), name), new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + service.upload(new B2WriteFeature(session, fileid), test, new Local(System.getProperty("java.io.tmpdir"), name), new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledLoginCallback()); } catch(BackgroundException e) { // Expected @@ -143,7 +142,7 @@ public BaseB2Response transfer(final Write write, final Path fil final TransferStatus append = new TransferStatus().setAppend(true).setLength(content.length); service.upload(new B2WriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), append, - new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledLoginCallback()); assertEquals(content.length, append.getResponse().getSize()); assertTrue(new B2FindFeature(session, fileid).find(test)); assertEquals(content.length, new B2AttributesFinderFeature(session, fileid).find(test).getSize()); @@ -172,18 +171,18 @@ public void testAppendSecondPart() throws Exception { final B2VersionIdProvider fileid = new B2VersionIdProvider(session); final B2LargeUploadService feature = new B2LargeUploadService(session, fileid, 5 * 1000L * 1000L, 1) { @Override - public BaseB2Response transfer(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final StreamCancelation cancel, final StreamProgress progress, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + public BaseB2Response transfer(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final StreamCancelation cancel, final StreamProgress progress, final ConnectionCallback callback) throws BackgroundException { if(!interrupt.get()) { if(status.getOffset() >= 5L * 1000L * 1000L) { throw new ConnectionTimeoutException("Test"); } } - return super.transfer(write, file, local, throttle, listener, status, cancel, progress, callback, options); + return super.transfer(write, file, local, throttle, listener, status, cancel, progress, callback); } }; final BytecountStreamListener count = new BytecountStreamListener(); try { - feature.upload(new B2WriteFeature(session, fileid), test, new Local(System.getProperty("java.io.tmpdir"), name), new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + feature.upload(new B2WriteFeature(session, fileid), test, new Local(System.getProperty("java.io.tmpdir"), name), new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledLoginCallback()); } catch(BackgroundException e) { // Expected @@ -202,7 +201,7 @@ public BaseB2Response transfer(final Write write, final Path fil final TransferStatus append = new TransferStatus().setAppend(true).setLength(2L * 1000L * 1000L).setOffset(5 * 1000L * 1000L); feature.upload(new B2WriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, append, - new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledLoginCallback()); assertEquals(6 * 1000L * 1000L, count.getSent()); assertTrue(append.isComplete()); assertEquals(content.length, append.getResponse().getSize()); diff --git a/backblaze/src/test/java/ch/cyberduck/core/b2/B2ReadFeatureTest.java b/backblaze/src/test/java/ch/cyberduck/core/b2/B2ReadFeatureTest.java index e0ff0a5e6b6..cef2a623fda 100644 --- a/backblaze/src/test/java/ch/cyberduck/core/b2/B2ReadFeatureTest.java +++ b/backblaze/src/test/java/ch/cyberduck/core/b2/B2ReadFeatureTest.java @@ -32,7 +32,6 @@ import ch.cyberduck.core.io.StreamCopier; import ch.cyberduck.core.shared.DefaultDownloadFeature; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -132,7 +131,7 @@ public void testReadRange() throws Exception { final BaseB2Response reply = new B2SingleUploadService().upload( new B2WriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); @@ -164,7 +163,7 @@ public void testReadRangeUnknownLength() throws Exception { new B2SingleUploadService().upload( new B2WriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); final TransferStatus status = new TransferStatus(); status.setLength(-1L); status.setAppend(true); diff --git a/backblaze/src/test/java/ch/cyberduck/core/b2/B2SingleUploadServiceTest.java b/backblaze/src/test/java/ch/cyberduck/core/b2/B2SingleUploadServiceTest.java index 9c54a078923..4b8808fb89c 100644 --- a/backblaze/src/test/java/ch/cyberduck/core/b2/B2SingleUploadServiceTest.java +++ b/backblaze/src/test/java/ch/cyberduck/core/b2/B2SingleUploadServiceTest.java @@ -28,7 +28,6 @@ import ch.cyberduck.core.io.SHA1ChecksumCompute; import ch.cyberduck.core.io.StreamCopier; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -64,7 +63,7 @@ public void testUpload() throws Exception { final B2VersionIdProvider fileid = new B2VersionIdProvider(session); final B2SingleUploadService upload = new B2SingleUploadService(); upload.upload(new B2WriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), - status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + status, new DisabledConnectionCallback()); assertEquals(checksum, new B2AttributesFinderFeature(session, fileid).find(test).getChecksum()); status.validate(); assertTrue(status.isComplete()); diff --git a/backblaze/src/test/java/ch/cyberduck/core/cryptomator/B2LargeUploadServiceTest.java b/backblaze/src/test/java/ch/cyberduck/core/cryptomator/B2LargeUploadServiceTest.java index 48b29e97c80..868c5e95afb 100644 --- a/backblaze/src/test/java/ch/cyberduck/core/cryptomator/B2LargeUploadServiceTest.java +++ b/backblaze/src/test/java/ch/cyberduck/core/cryptomator/B2LargeUploadServiceTest.java @@ -44,7 +44,6 @@ import ch.cyberduck.core.transfer.Transfer; import ch.cyberduck.core.transfer.TransferItem; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.DefaultVaultRegistry; import ch.cyberduck.core.vault.VaultCredentials; import ch.cyberduck.test.IntegrationTest; @@ -94,7 +93,7 @@ public void testWrite() throws Exception { writeStatus.setLength(content.length); final Path test = new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); final BytecountStreamListener counter = new BytecountStreamListener(); - service.upload(new CryptoWriteFeature<>(session, new B2WriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), counter, writeStatus, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + service.upload(new CryptoWriteFeature<>(session, new B2WriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), counter, writeStatus, new DisabledConnectionCallback()); assertEquals(content.length, counter.getSent()); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new B2FindFeature(session, fileid)).find(test)); @@ -130,7 +129,7 @@ public void testUploadWithBulk() throws Exception { final Local local = new Local(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString()); IOUtils.write(content, local.getOutputStream(false)); final BytecountStreamListener counter = new BytecountStreamListener(); - service.upload(new CryptoWriteFeature<>(session, new B2WriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), counter, writeStatus, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + service.upload(new CryptoWriteFeature<>(session, new B2WriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), counter, writeStatus, new DisabledConnectionCallback()); assertEquals(content.length, counter.getSent()); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new B2FindFeature(session, fileid)).find(test)); diff --git a/backblaze/src/test/java/ch/cyberduck/core/worker/B2ConcurrentTransferWorkerTest.java b/backblaze/src/test/java/ch/cyberduck/core/worker/B2ConcurrentTransferWorkerTest.java index d216d8ea850..e124cc23326 100644 --- a/backblaze/src/test/java/ch/cyberduck/core/worker/B2ConcurrentTransferWorkerTest.java +++ b/backblaze/src/test/java/ch/cyberduck/core/worker/B2ConcurrentTransferWorkerTest.java @@ -43,7 +43,6 @@ import ch.cyberduck.core.transfer.TransferSpeedometer; import ch.cyberduck.core.transfer.TransferStatus; import ch.cyberduck.core.transfer.UploadTransfer; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.DefaultVaultRegistry; import ch.cyberduck.test.IntegrationTest; @@ -113,7 +112,7 @@ public Session create() { final B2LargeUploadService upload = new B2LargeUploadService(this, new B2VersionIdProvider(this) ) { @Override - protected InputStream decorate(final InputStream in, final TransferStatus status, final UploadFilterOptions options) { + protected InputStream decorate(final InputStream in, final TransferStatus status) { if(failed.get()) { // Second attempt successful return in; diff --git a/backblaze/src/test/java/ch/cyberduck/core/worker/B2SingleTransferWorkerTest.java b/backblaze/src/test/java/ch/cyberduck/core/worker/B2SingleTransferWorkerTest.java index b9649b8720a..4bba34ac891 100644 --- a/backblaze/src/test/java/ch/cyberduck/core/worker/B2SingleTransferWorkerTest.java +++ b/backblaze/src/test/java/ch/cyberduck/core/worker/B2SingleTransferWorkerTest.java @@ -41,8 +41,15 @@ import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader; import ch.cyberduck.core.ssl.DefaultX509KeyManager; import ch.cyberduck.core.ssl.DefaultX509TrustManager; -import ch.cyberduck.core.transfer.*; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; +import ch.cyberduck.core.transfer.DisabledTransferErrorCallback; +import ch.cyberduck.core.transfer.DisabledTransferPrompt; +import ch.cyberduck.core.transfer.Transfer; +import ch.cyberduck.core.transfer.TransferAction; +import ch.cyberduck.core.transfer.TransferItem; +import ch.cyberduck.core.transfer.TransferOptions; +import ch.cyberduck.core.transfer.TransferSpeedometer; +import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.UploadTransfer; import ch.cyberduck.test.IntegrationTest; import ch.cyberduck.test.VaultTest; @@ -103,7 +110,7 @@ public String getProperty(final String key) { final B2LargeUploadService upload = new B2LargeUploadService(this, new B2VersionIdProvider(this) ) { @Override - protected InputStream decorate(final InputStream in, final TransferStatus status, final UploadFilterOptions options) { + protected InputStream decorate(final InputStream in, final TransferStatus status) { if(failed.get()) { // Second attempt successful return in; diff --git a/box/src/main/java/ch/cyberduck/core/box/BoxLargeUploadService.java b/box/src/main/java/ch/cyberduck/core/box/BoxLargeUploadService.java index 77c7f4a4b86..ea8f18ae8dd 100644 --- a/box/src/main/java/ch/cyberduck/core/box/BoxLargeUploadService.java +++ b/box/src/main/java/ch/cyberduck/core/box/BoxLargeUploadService.java @@ -41,8 +41,6 @@ import ch.cyberduck.core.transfer.SegmentRetryCallable; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; - import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -78,7 +76,7 @@ public BoxLargeUploadService(final BoxSession session, final BoxFileidProvider f @Override public File upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { final ThreadPool pool = ThreadPoolFactory.get("multipart", concurrency); try { if(status.getChecksum().algorithm != HashAlgorithm.sha1) { @@ -92,7 +90,7 @@ public File upload(final Write write, final Path file, final Local local, for(int partNumber = 1; remaining > 0; partNumber++) { final long length = Math.min(uploadSession.getPartSize(), remaining); parts.add(this.submit(pool, write, file, local, throttle, streamListener, status, - uploadSession.getId(), partNumber, offset, length, callback, options)); + uploadSession.getId(), partNumber, offset, length, callback)); remaining -= length; offset += length; } @@ -120,7 +118,7 @@ public File upload(final Write write, final Path file, final Local local, private Future submit(final ThreadPool pool, final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, - final TransferStatus overall, final String uploadSessionId, final int partNumber, final long offset, final long length, final ConnectionCallback callback, final UploadFilterOptions options) { + final TransferStatus overall, final String uploadSessionId, final int partNumber, final long offset, final long length, final ConnectionCallback callback) { log.info("Submit {} to queue with offset {} and length {}", file, offset, length); final BytecountStreamListener counter = new BytecountStreamListener(listener); return pool.execute(new SegmentRetryCallable<>(session.getHost(), new BackgroundExceptionCallable() { @@ -139,7 +137,7 @@ public Part call() throws BackgroundException { parameters.put(OVERALL_LENGTH, String.valueOf(overall.getLength())); status.setParameters(parameters); final File response = BoxLargeUploadService.this.transfer( - write, file, local, throttle, listener, status, overall, status, callback, options); + write, file, local, throttle, listener, status, overall, status, callback); log.info("Received response {} for part {}", response, partNumber); return new Part(response, status); } diff --git a/box/src/main/java/ch/cyberduck/core/box/BoxThresholdUploadService.java b/box/src/main/java/ch/cyberduck/core/box/BoxThresholdUploadService.java index 4c15cfca3d6..46bea05e2f4 100644 --- a/box/src/main/java/ch/cyberduck/core/box/BoxThresholdUploadService.java +++ b/box/src/main/java/ch/cyberduck/core/box/BoxThresholdUploadService.java @@ -28,7 +28,6 @@ import ch.cyberduck.core.io.StreamListener; import ch.cyberduck.core.preferences.HostPreferencesFactory; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.VaultRegistry; public class BoxThresholdUploadService implements Upload { @@ -45,14 +44,14 @@ public BoxThresholdUploadService(final BoxSession session, final BoxFileidProvid @Override public File upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { if(this.threshold(status.getLength())) { if(Vault.DISABLED == registry.find(session, file)) { - return new BoxLargeUploadService(session, fileid).upload(write, file, local, throttle, progress, streamListener, status, callback, options); + return new BoxLargeUploadService(session, fileid).upload(write, file, local, throttle, progress, streamListener, status, callback); } // Cannot comply with chunk size requirement from server } - return new BoxSmallUploadService().upload(write, file, local, throttle, progress, streamListener, status, callback, options); + return new BoxSmallUploadService().upload(write, file, local, throttle, progress, streamListener, status, callback); } protected boolean threshold(final Long length) { diff --git a/box/src/test/java/ch/cyberduck/core/box/BoxLargeUploadServiceTest.java b/box/src/test/java/ch/cyberduck/core/box/BoxLargeUploadServiceTest.java index ae749319fab..2112d9f4455 100644 --- a/box/src/test/java/ch/cyberduck/core/box/BoxLargeUploadServiceTest.java +++ b/box/src/test/java/ch/cyberduck/core/box/BoxLargeUploadServiceTest.java @@ -28,7 +28,6 @@ import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.SHA1ChecksumCompute; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -59,7 +58,7 @@ public void testUploadLargeFileInChunks() throws Exception { status.setChecksum(new SHA1ChecksumCompute().compute(local.getInputStream(), new TransferStatus())); status.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); - final File response = s.upload(new BoxWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + final File response = s.upload(new BoxWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback()); assertTrue(status.isComplete()); assertNotNull(response.getSha1()); assertEquals(content.length, count.getSent()); diff --git a/box/src/test/java/ch/cyberduck/core/cryptomator/BoxThresholdUploadServiceTest.java b/box/src/test/java/ch/cyberduck/core/cryptomator/BoxThresholdUploadServiceTest.java index eaa6da4d0b6..1c604e5f503 100644 --- a/box/src/test/java/ch/cyberduck/core/cryptomator/BoxThresholdUploadServiceTest.java +++ b/box/src/test/java/ch/cyberduck/core/cryptomator/BoxThresholdUploadServiceTest.java @@ -45,7 +45,6 @@ import ch.cyberduck.core.transfer.Transfer; import ch.cyberduck.core.transfer.TransferItem; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.DefaultVaultRegistry; import ch.cyberduck.core.vault.VaultCredentials; import ch.cyberduck.test.IntegrationTest; @@ -95,7 +94,7 @@ public void testUploadVaultWithBulkFeature() throws Exception { final CryptoUploadFeature feature = new CryptoUploadFeature<>(session, new BoxThresholdUploadService(session, fileid, registry), cryptomator); - feature.upload(new BoxWriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + feature.upload(new BoxWriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, new DisabledConnectionCallback()); assertEquals(content.length, count.getSent()); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new BoxFindFeature(session, fileid)).find(test)); diff --git a/brick/src/main/java/ch/cyberduck/core/brick/BrickThresholdUploadFeature.java b/brick/src/main/java/ch/cyberduck/core/brick/BrickThresholdUploadFeature.java index 72a210bedac..4fc8435a526 100644 --- a/brick/src/main/java/ch/cyberduck/core/brick/BrickThresholdUploadFeature.java +++ b/brick/src/main/java/ch/cyberduck/core/brick/BrickThresholdUploadFeature.java @@ -26,7 +26,6 @@ import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.StreamListener; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; public class BrickThresholdUploadFeature implements Upload { @@ -37,9 +36,9 @@ public BrickThresholdUploadFeature(final BrickSession session) { } @Override - public FileEntity upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + public FileEntity upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { if(status.getLength() > 0) { - return new BrickUploadFeature(session).upload(write, file, local, throttle, progress, streamListener, status, callback, options); + return new BrickUploadFeature(session).upload(write, file, local, throttle, progress, streamListener, status, callback); } else { new BrickTouchFeature(session).touch(write, file, status); diff --git a/brick/src/main/java/ch/cyberduck/core/brick/BrickUploadFeature.java b/brick/src/main/java/ch/cyberduck/core/brick/BrickUploadFeature.java index e039866c837..28bebc09377 100644 --- a/brick/src/main/java/ch/cyberduck/core/brick/BrickUploadFeature.java +++ b/brick/src/main/java/ch/cyberduck/core/brick/BrickUploadFeature.java @@ -42,8 +42,6 @@ import ch.cyberduck.core.transfer.SegmentRetryCallable; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; - import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -80,7 +78,7 @@ public BrickUploadFeature(final BrickSession session, final Long partsize, final @Override public FileEntity upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { final ThreadPool pool = ThreadPoolFactory.get("multipart", concurrency); try { // Full size of file @@ -99,7 +97,7 @@ public FileEntity upload(final Write write, final Path file, final L length = remaining; } parts.add(this.submit(pool, write, file, local, throttle, streamListener, status, - uploadPartEntity.getUploadUri(), partNumber, offset, length, callback, options)); + uploadPartEntity.getUploadUri(), partNumber, offset, length, callback)); remaining -= length; offset += length; ref = uploadPartEntity.getRef(); @@ -153,7 +151,7 @@ protected FileEntity completeUpload(final Path file, final String ref, final Tra private Future submit(final ThreadPool pool, final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus overall, final String url, final Integer partNumber, - final long offset, final long length, final ConnectionCallback callback, final UploadFilterOptions options) throws ConnectionCanceledException { + final long offset, final long length, final ConnectionCallback callback) throws ConnectionCanceledException { overall.validate(); log.info("Submit part {} of {} to queue with offset {} and length {}", partNumber, file, offset, length); final BytecountStreamListener counter = new BytecountStreamListener(listener); @@ -170,7 +168,7 @@ public TransferStatus call() throws BackgroundException { status.setPart(partNumber); status.setHeader(overall.getHeader()); BrickUploadFeature.super.transfer( - write, file, local, throttle, listener, status, overall, status, callback, options); + write, file, local, throttle, listener, status, overall, status, callback); log.info("Received response for part number {}", partNumber); return status; } diff --git a/brick/src/test/java/ch/cyberduck/core/brick/BrickCopyFeatureTest.java b/brick/src/test/java/ch/cyberduck/core/brick/BrickCopyFeatureTest.java index 638e2db1b37..bf7a5ebf11e 100644 --- a/brick/src/test/java/ch/cyberduck/core/brick/BrickCopyFeatureTest.java +++ b/brick/src/test/java/ch/cyberduck/core/brick/BrickCopyFeatureTest.java @@ -28,7 +28,6 @@ import ch.cyberduck.core.shared.DefaultFindFeature; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -65,7 +64,7 @@ public void testCopyFile() throws Exception { IOUtils.write(random, local.getOutputStream(false)); final TransferStatus status = new TransferStatus().setLength(random.length); new BrickUploadFeature(session).upload(new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); local.delete(); assertTrue(new BrickFindFeature(session).find(test)); final Path copy = new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); @@ -86,7 +85,7 @@ public void testCopyToExistingFile() throws Exception { IOUtils.write(random, local.getOutputStream(false)); final TransferStatus status = new TransferStatus().setLength(random.length); new BrickUploadFeature(session).upload(new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); local.delete(); assertTrue(new BrickFindFeature(session).find(test)); final Path copy = new Path(folder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); @@ -109,7 +108,7 @@ public void testCopyDirectory() throws Exception { IOUtils.write(random, local.getOutputStream(false)); final TransferStatus status = new TransferStatus().setLength(random.length); new BrickUploadFeature(session).upload(new BrickWriteFeature(session), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); local.delete(); assertTrue(new BrickFindFeature(session).find(file)); final Path copy = new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)); diff --git a/brick/src/test/java/ch/cyberduck/core/brick/BrickDeleteFeatureTest.java b/brick/src/test/java/ch/cyberduck/core/brick/BrickDeleteFeatureTest.java index c3dff03059e..1b1aa02c0c5 100644 --- a/brick/src/test/java/ch/cyberduck/core/brick/BrickDeleteFeatureTest.java +++ b/brick/src/test/java/ch/cyberduck/core/brick/BrickDeleteFeatureTest.java @@ -25,7 +25,6 @@ import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -52,7 +51,7 @@ public void testDeleteWithLock() throws Exception { IOUtils.write(random, local.getOutputStream(false)); final TransferStatus status = new TransferStatus().setLength(random.length); new BrickUploadFeature(session).upload(new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); local.delete(); final String lock = new BrickLockFeature(session).lock(test); assertNotNull(lock); diff --git a/brick/src/test/java/ch/cyberduck/core/brick/BrickLockFeatureTest.java b/brick/src/test/java/ch/cyberduck/core/brick/BrickLockFeatureTest.java index ab0b76a10ed..89a980fb9ff 100644 --- a/brick/src/test/java/ch/cyberduck/core/brick/BrickLockFeatureTest.java +++ b/brick/src/test/java/ch/cyberduck/core/brick/BrickLockFeatureTest.java @@ -27,7 +27,6 @@ import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -57,7 +56,7 @@ public void testLock() throws Exception { final Path test = new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); final BrickUploadFeature upload = new BrickUploadFeature(session); upload.upload(new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback()); assertTrue(new BrickFindFeature(session).find(test)); final BrickLockFeature feature = new BrickLockFeature(session); final String lockid = feature.lock(test); diff --git a/brick/src/test/java/ch/cyberduck/core/brick/BrickMoveFeatureTest.java b/brick/src/test/java/ch/cyberduck/core/brick/BrickMoveFeatureTest.java index 1ffc9b9a0fd..260ed83dc36 100644 --- a/brick/src/test/java/ch/cyberduck/core/brick/BrickMoveFeatureTest.java +++ b/brick/src/test/java/ch/cyberduck/core/brick/BrickMoveFeatureTest.java @@ -30,7 +30,6 @@ import ch.cyberduck.core.synchronization.Comparison; import ch.cyberduck.core.synchronization.ComparisonService; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -97,7 +96,7 @@ public void testMoveWithLock() throws Exception { IOUtils.write(random, local.getOutputStream(false)); final TransferStatus status = new TransferStatus().setLength(random.length); new BrickUploadFeature(session).upload(new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); local.delete(); final String lock = new BrickLockFeature(session).lock(test); final Path target = new BrickMoveFeature(session).move(test, diff --git a/brick/src/test/java/ch/cyberduck/core/brick/BrickReadFeatureTest.java b/brick/src/test/java/ch/cyberduck/core/brick/BrickReadFeatureTest.java index 7785722ec4c..52f26fe9196 100644 --- a/brick/src/test/java/ch/cyberduck/core/brick/BrickReadFeatureTest.java +++ b/brick/src/test/java/ch/cyberduck/core/brick/BrickReadFeatureTest.java @@ -29,7 +29,6 @@ import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.io.StreamCopier; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -107,7 +106,7 @@ public void testReadRange() throws Exception { upload.setExists(true); new BrickUploadFeature(session).upload( new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), upload, - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); @@ -139,7 +138,7 @@ public void testReadRangeUnknownLength() throws Exception { upload.setExists(true); new BrickUploadFeature(session).upload( new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), upload, - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); final TransferStatus status = new TransferStatus(); status.setLength(-1L); status.setAppend(true); diff --git a/brick/src/test/java/ch/cyberduck/core/brick/BrickThresholdUploadFeatureTest.java b/brick/src/test/java/ch/cyberduck/core/brick/BrickThresholdUploadFeatureTest.java index f16b15472da..74fe3975b44 100644 --- a/brick/src/test/java/ch/cyberduck/core/brick/BrickThresholdUploadFeatureTest.java +++ b/brick/src/test/java/ch/cyberduck/core/brick/BrickThresholdUploadFeatureTest.java @@ -26,7 +26,6 @@ import ch.cyberduck.core.features.Delete; import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -56,7 +55,7 @@ public void testUploadZeroLength() throws Exception { status.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); feature.upload(new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), count, status, new DisabledLoginCallback()); assertEquals(content.length, count.getSent()); assertTrue(new BrickFindFeature(session).find(test)); final PathAttributes attributes = new BrickAttributesFinderFeature(session).find(test); @@ -82,7 +81,7 @@ public void testUpload() throws Exception { status.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); feature.upload(new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), count, status, new DisabledLoginCallback()); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); assertTrue(new BrickFindFeature(session).find(test)); diff --git a/brick/src/test/java/ch/cyberduck/core/brick/BrickUploadFeatureTest.java b/brick/src/test/java/ch/cyberduck/core/brick/BrickUploadFeatureTest.java index e75dd4957fc..71b23104823 100644 --- a/brick/src/test/java/ch/cyberduck/core/brick/BrickUploadFeatureTest.java +++ b/brick/src/test/java/ch/cyberduck/core/brick/BrickUploadFeatureTest.java @@ -26,7 +26,6 @@ import ch.cyberduck.core.features.Delete; import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -58,7 +57,7 @@ public void testUploadSmallPart() throws Exception { status.setMime("text/plain"); final BytecountStreamListener count = new BytecountStreamListener(); feature.upload(new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), count, status, new DisabledLoginCallback()); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); assertNotSame(PathAttributes.EMPTY, status.getResponse()); @@ -87,7 +86,7 @@ public void testUploadSinglePart() throws Exception { status.setMime("text/plain"); final BytecountStreamListener count = new BytecountStreamListener(); feature.upload(new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), count, status, new DisabledLoginCallback()); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); assertNotSame(PathAttributes.EMPTY, status.getResponse()); @@ -114,7 +113,7 @@ public void testUploadMultipleParts() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); - feature.upload(new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + feature.upload(new BrickWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback()); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); assertNotSame(PathAttributes.EMPTY, status.getResponse()); diff --git a/brick/src/test/java/ch/cyberduck/core/worker/CopyWorkerTest.java b/brick/src/test/java/ch/cyberduck/core/worker/CopyWorkerTest.java index da85eb3ebab..ab54439a446 100644 --- a/brick/src/test/java/ch/cyberduck/core/worker/CopyWorkerTest.java +++ b/brick/src/test/java/ch/cyberduck/core/worker/CopyWorkerTest.java @@ -32,7 +32,6 @@ import ch.cyberduck.core.pool.SessionPool; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -60,7 +59,7 @@ public void testCopyFile() throws Exception { IOUtils.write(random, local.getOutputStream(false)); final TransferStatus status = new TransferStatus().setLength(random.length); new BrickUploadFeature(session).upload(new BrickWriteFeature(session), source, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); assertTrue(new BrickFindFeature(session).find(source)); final CopyWorker worker = new CopyWorker(Collections.singletonMap(source, target), new SessionPool.SingleSessionPool(session), PathCache.empty(), new DisabledProgressListener(), new DisabledConnectionCallback()); worker.run(session); @@ -80,7 +79,7 @@ public void testCopyFileToDirectory() throws Exception { IOUtils.write(random, local.getOutputStream(false)); final TransferStatus status = new TransferStatus().setLength(random.length); new BrickUploadFeature(session).upload(new BrickWriteFeature(session), sourceFile, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); assertTrue(new BrickFindFeature(session).find(sourceFile)); final Path targetFolder = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)); final Path targetFile = new Path(targetFolder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); @@ -106,7 +105,7 @@ public void testCopyDirectory() throws Exception { IOUtils.write(random, local.getOutputStream(false)); final TransferStatus status = new TransferStatus().setLength(random.length); new BrickUploadFeature(session).upload(new BrickWriteFeature(session), sourceFile, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); assertTrue(new BrickFindFeature(session).find(folder)); assertTrue(new BrickFindFeature(session).find(sourceFile)); final Path targetFolder = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)); diff --git a/core/src/main/java/ch/cyberduck/core/features/Upload.java b/core/src/main/java/ch/cyberduck/core/features/Upload.java index 95b83b46684..eb1f86afc4f 100644 --- a/core/src/main/java/ch/cyberduck/core/features/Upload.java +++ b/core/src/main/java/ch/cyberduck/core/features/Upload.java @@ -23,7 +23,6 @@ import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.StreamListener; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; @Optional public interface Upload { @@ -39,11 +38,10 @@ public interface Upload { * @param streamListener Stream copy callback * @param status Transfer status holder * @param callback Prompt - * @param options * @see AttributesAdapter#toAttributes(Reply) */ Reply upload(Write write, Path file, Local local, BandwidthThrottle throttle, final ProgressListener progress, StreamListener streamListener, - TransferStatus status, ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException; + TransferStatus status, ConnectionCallback callback) throws BackgroundException; /** * Determine if appending to file is supported diff --git a/core/src/main/java/ch/cyberduck/core/shared/DefaultUploadFeature.java b/core/src/main/java/ch/cyberduck/core/shared/DefaultUploadFeature.java index 6ed5595da11..24a14aac8b5 100644 --- a/core/src/main/java/ch/cyberduck/core/shared/DefaultUploadFeature.java +++ b/core/src/main/java/ch/cyberduck/core/shared/DefaultUploadFeature.java @@ -33,7 +33,6 @@ import ch.cyberduck.core.io.StreamProgress; import ch.cyberduck.core.io.ThrottledOutputStream; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -46,16 +45,16 @@ public class DefaultUploadFeature implements Upload { @Override public Reply upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, - final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { - final Reply response = this.transfer(write, file, local, throttle, streamListener, status, status, status, callback, options); + final ConnectionCallback callback) throws BackgroundException { + final Reply response = this.transfer(write, file, local, throttle, streamListener, status, status, status, callback); log.debug("Received response {}", response); return response; } protected Reply transfer(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final StreamCancelation cancel, final StreamProgress progress, - final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { - final InputStream in = this.decorate(local.getInputStream(), status, options); + final ConnectionCallback callback) throws BackgroundException { + final InputStream in = this.decorate(local.getInputStream(), status); final StatusOutputStream out = write.write(file, status, callback); new StreamCopier(cancel, progress) .withOffset(status.getOffset()) @@ -68,12 +67,11 @@ protected Reply transfer(final Write write, final Path file, final Local /** * Wrap input stream if checksum calculation is enabled. * - * @param in File input stream + * @param in File input stream * @param status - * @param options * @return Wrapped or same stream */ - protected InputStream decorate(final InputStream in, final TransferStatus status, final UploadFilterOptions options) throws BackgroundException { + protected InputStream decorate(final InputStream in, final TransferStatus status) throws BackgroundException { return in; } } diff --git a/core/src/main/java/ch/cyberduck/core/transfer/UploadTransfer.java b/core/src/main/java/ch/cyberduck/core/transfer/UploadTransfer.java index 81704620c8d..61844e7e38c 100644 --- a/core/src/main/java/ch/cyberduck/core/transfer/UploadTransfer.java +++ b/core/src/main/java/ch/cyberduck/core/transfer/UploadTransfer.java @@ -322,7 +322,7 @@ public void transfer(final Session source, final Session destination, fina file.getName())); // Transfer source.getFeature(Upload.class).upload(source.getFeature(Write.class), - file, local, bandwidth, progress, listener, segment, prompt, this.options); + file, local, bandwidth, progress, listener, segment, prompt); } } diff --git a/core/src/main/java/ch/cyberduck/core/vault/registry/VaultRegistryUploadFeature.java b/core/src/main/java/ch/cyberduck/core/vault/registry/VaultRegistryUploadFeature.java index ecf09e18041..e1e63cf1d9c 100644 --- a/core/src/main/java/ch/cyberduck/core/vault/registry/VaultRegistryUploadFeature.java +++ b/core/src/main/java/ch/cyberduck/core/vault/registry/VaultRegistryUploadFeature.java @@ -26,7 +26,6 @@ import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.StreamListener; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.VaultRegistry; public class VaultRegistryUploadFeature implements Upload { @@ -43,8 +42,8 @@ public VaultRegistryUploadFeature(final Session session, final Upload @Override @SuppressWarnings("unchecked") - public Output upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { - return (Output) registry.find(session, file).getFeature(session, Upload.class, proxy).upload(write, file, local, throttle, progress, streamListener, status, callback, options); + public Output upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { + return (Output) registry.find(session, file).getFeature(session, Upload.class, proxy).upload(write, file, local, throttle, progress, streamListener, status, callback); } @Override diff --git a/core/src/test/java/ch/cyberduck/core/NullUploadFeature.java b/core/src/test/java/ch/cyberduck/core/NullUploadFeature.java index 589e9b8fbf3..cf392e963fa 100644 --- a/core/src/test/java/ch/cyberduck/core/NullUploadFeature.java +++ b/core/src/test/java/ch/cyberduck/core/NullUploadFeature.java @@ -19,13 +19,12 @@ import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.StreamListener; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; public class NullUploadFeature implements Upload { @Override public Void upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { return null; } diff --git a/cryptomator/src/main/java/ch/cyberduck/core/cryptomator/features/CryptoUploadFeature.java b/cryptomator/src/main/java/ch/cyberduck/core/cryptomator/features/CryptoUploadFeature.java index 6f6bb197529..2f2c1317338 100644 --- a/cryptomator/src/main/java/ch/cyberduck/core/cryptomator/features/CryptoUploadFeature.java +++ b/cryptomator/src/main/java/ch/cyberduck/core/cryptomator/features/CryptoUploadFeature.java @@ -28,7 +28,6 @@ import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.StreamListener; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; public class CryptoUploadFeature implements Upload { @@ -43,8 +42,8 @@ public CryptoUploadFeature(final Session session, final Upload delegat } @Override - public Reply upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { - return proxy.upload(write, vault.encrypt(session, file), local, throttle, progress, streamListener, status.setDestinationLength(new CryptoTransferStatus(vault, status).getLength()), callback, options); + public Reply upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { + return proxy.upload(write, vault.encrypt(session, file), local, throttle, progress, streamListener, status.setDestinationLength(new CryptoTransferStatus(vault, status).getLength()), callback); } @Override diff --git a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraConcurrentTransferWorkerTest.java b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraConcurrentTransferWorkerTest.java index 82073349aac..34093f5f8ea 100644 --- a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraConcurrentTransferWorkerTest.java +++ b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraConcurrentTransferWorkerTest.java @@ -43,7 +43,6 @@ import ch.cyberduck.core.transfer.TransferOptions; import ch.cyberduck.core.transfer.TransferSpeedometer; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.worker.ConcurrentTransferWorker; import ch.cyberduck.test.IntegrationTest; @@ -70,7 +69,7 @@ public void testBelowSegmentSizeUpAndDownload() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DAVUploadFeature().upload(new CteraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DAVUploadFeature().upload(new CteraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), new DisabledConnectionCallback()); assertEquals(content.length, new DAVAttributesFinderFeature(session).find(test).getSize()); final Local localFile = new DefaultTemporaryFileService().create(test.getName()); final Transfer download = new DownloadTransfer(new Host(new TestProtocol()), Collections.singletonList(new TransferItem(test, localFile)), new NullFilter<>()); @@ -98,7 +97,7 @@ public void testLargeUpAndDownload() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DAVUploadFeature().upload(new CteraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DAVUploadFeature().upload(new CteraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), new DisabledConnectionCallback()); assertEquals(content.length, new DAVAttributesFinderFeature(session).find(test).getSize()); final Local localFile = new DefaultTemporaryFileService().create(test.getName()); final Transfer download = new DownloadTransfer(new Host(new TestProtocol()), Collections.singletonList(new TransferItem(test, localFile)), new NullFilter<>()); diff --git a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraDirectIOReadFeatureTest.java b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraDirectIOReadFeatureTest.java index 436486c13a9..69f207c8ed2 100644 --- a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraDirectIOReadFeatureTest.java +++ b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraDirectIOReadFeatureTest.java @@ -31,7 +31,6 @@ import ch.cyberduck.core.transfer.Transfer; import ch.cyberduck.core.transfer.TransferItem; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -63,7 +62,7 @@ public void testReadChunk() throws Exception { new DAVUploadFeature().upload( new CteraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); final TransferStatus status = new TransferStatus(); final TransferStatus segment = new TransferStatus().setSegment(true); status.setSegments(Collections.singletonList(segment)); diff --git a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraReadFeatureTest.java b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraReadFeatureTest.java index 66371e5667e..971908cbedb 100644 --- a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraReadFeatureTest.java +++ b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraReadFeatureTest.java @@ -32,7 +32,6 @@ import ch.cyberduck.core.shared.DefaultDownloadFeature; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -79,7 +78,7 @@ public void testReadChunkedTransfer() throws Exception { new DAVUploadFeature().upload( new CteraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); // Unknown length in status final TransferStatus status = new TransferStatus() { @Override @@ -127,7 +126,7 @@ public void testReadRange() throws Exception { new DAVUploadFeature().upload( new CteraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); @@ -155,7 +154,7 @@ public void testReadRangeUnknownLength() throws Exception { new DAVUploadFeature().upload( new CteraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); final TransferStatus status = new TransferStatus(); status.setLength(-1L); status.setAppend(true); diff --git a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraWriteFeatureTest.java b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraWriteFeatureTest.java index f55f73a858e..a027bd751fa 100644 --- a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraWriteFeatureTest.java +++ b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraWriteFeatureTest.java @@ -19,7 +19,6 @@ import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -60,7 +59,7 @@ public void testReadWrite() throws Exception { final Path test = new Path(folder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); final HttpUploadFeature upload = new DAVUploadFeature(); upload.upload(new CteraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback()); assertTrue(session.getFeature(Find.class).find(test)); assertEquals(content.length, new CteraListService(session).list(test.getParent(), new DisabledListProgressListener()) .find(new SimplePathPredicate(test)).attributes().getSize(), 0L); @@ -100,7 +99,7 @@ public void testReplaceContent() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(content.length); upload.upload(new CteraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback()); } final PathAttributes attr1 = new CteraAttributesFinderFeature(session).find(test); Thread.sleep(1000L); @@ -112,7 +111,7 @@ public void testReplaceContent() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(content.length); upload.upload(new CteraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback()); } final PathAttributes attr2 = new CteraAttributesFinderFeature(session).find(test); assertEquals(101L, attr2.getSize()); diff --git a/dracoon/src/main/java/ch/cyberduck/core/sds/SDSDirectS3UploadFeature.java b/dracoon/src/main/java/ch/cyberduck/core/sds/SDSDirectS3UploadFeature.java index dcf49fa464a..c37dc8a6664 100644 --- a/dracoon/src/main/java/ch/cyberduck/core/sds/SDSDirectS3UploadFeature.java +++ b/dracoon/src/main/java/ch/cyberduck/core/sds/SDSDirectS3UploadFeature.java @@ -57,8 +57,6 @@ import ch.cyberduck.core.transfer.SegmentRetryCallable; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; - import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -112,7 +110,7 @@ public SDSDirectS3UploadFeature(final SDSSession session, final SDSNodeIdProvide @Override public Node upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { final ThreadPool pool = ThreadPoolFactory.get("multipart", concurrency); try { final InputStream in; @@ -151,11 +149,11 @@ public Node upload(final Write write, final Path file, final Local local, new StreamCopier(status, StreamProgress.noop).withAutoclose(false).withLimit(length) .transfer(in, new BufferOutputStream(buffer)); parts.add(this.submit(pool, write, file, temporary, buffer, throttle, streamListener, status, - presignedUrl.getUrl(), presignedUrl.getPartNumber(), 0L, length, callback, options)); + presignedUrl.getUrl(), presignedUrl.getPartNumber(), 0L, length, callback)); } else { parts.add(this.submit(pool, write, file, local, Buffer.noop, throttle, streamListener, status, - presignedUrl.getUrl(), presignedUrl.getPartNumber(), offset, length, callback, options)); + presignedUrl.getUrl(), presignedUrl.getPartNumber(), offset, length, callback)); } remaining -= length; offset += length; @@ -238,7 +236,7 @@ private List retrievePresignedUrls(final CreateFileUploadResponse private Future submit(final ThreadPool pool, final Write write, final Path file, final Local local, final Buffer buffer, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus overall, final String url, final Integer partNumber, - final long offset, final long length, final ConnectionCallback callback, final UploadFilterOptions options) throws ConnectionCanceledException { + final long offset, final long length, final ConnectionCallback callback) throws ConnectionCanceledException { overall.validate(); log.info("Submit part {} of {} to queue with offset {} and length {}", partNumber, file, offset, length); final BytecountStreamListener counter = new BytecountStreamListener(listener); @@ -255,7 +253,7 @@ public TransferStatus call() throws BackgroundException { status.setHeader(overall.getHeader()); status.setFilekey(overall.getFilekey()); final Node node = SDSDirectS3UploadFeature.super.transfer( - write, file, local, throttle, counter, status, overall, status, callback, options); + write, file, local, throttle, counter, status, overall, status, callback); log.info("Received response for part number {}", partNumber); // Delete temporary file if any buffer.close(); diff --git a/dracoon/src/test/java/ch/cyberduck/core/sds/SDSDeleteFeatureTest.java b/dracoon/src/test/java/ch/cyberduck/core/sds/SDSDeleteFeatureTest.java index 21d430038df..2f1448b23e9 100644 --- a/dracoon/src/test/java/ch/cyberduck/core/sds/SDSDeleteFeatureTest.java +++ b/dracoon/src/test/java/ch/cyberduck/core/sds/SDSDeleteFeatureTest.java @@ -34,7 +34,6 @@ import ch.cyberduck.core.sds.io.swagger.client.model.RoomPoliciesRequest; import ch.cyberduck.core.shared.DefaultFindFeature; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -156,7 +155,7 @@ public void testDeleteEicar() throws Exception { status.setLength(eicar.length); final SDSDirectS3UploadFeature feature = new SDSDirectS3UploadFeature(session, nodeid); final Node node = feature.upload(new SDSDelegatingWriteFeature(session, nodeid, new SDSDirectS3WriteFeature(session, nodeid)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); assertTrue(new SDSFindFeature(session, nodeid).find(test)); final PathAttributes attributes = new SDSAttributesFinderFeature(session, nodeid).find(test); assertEquals(eicar.length, attributes.getSize()); diff --git a/dracoon/src/test/java/ch/cyberduck/core/sds/SDSDirectS3UploadFeatureTest.java b/dracoon/src/test/java/ch/cyberduck/core/sds/SDSDirectS3UploadFeatureTest.java index 1ff33732ed9..23d59199018 100644 --- a/dracoon/src/test/java/ch/cyberduck/core/sds/SDSDirectS3UploadFeatureTest.java +++ b/dracoon/src/test/java/ch/cyberduck/core/sds/SDSDirectS3UploadFeatureTest.java @@ -40,7 +40,6 @@ import ch.cyberduck.core.transfer.Transfer; import ch.cyberduck.core.transfer.TransferItem; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.VaultCredentials; import ch.cyberduck.test.IntegrationTest; @@ -84,7 +83,7 @@ public HttpResponseOutputStream write(final Path file, final TransferStatu return super.write(file, status, callback); } }, test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); fail(); } catch(ConnectionCanceledException e) { @@ -112,7 +111,7 @@ public void testUploadZeroByteFile() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(random.length); feature.upload(new SDSDelegatingWriteFeature(session, nodeid, session.getFeature(Write.class)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); assertTrue(new SDSFindFeature(session, nodeid).find(test)); final PathAttributes attributes = new SDSAttributesFinderFeature(session, nodeid).find(test); assertEquals(random.length, attributes.getSize()); @@ -132,7 +131,7 @@ public void testUploadMissingTargetDirectory() throws Exception { new DefaultLocalTouchFeature().touch(local); final TransferStatus status = new TransferStatus(); assertThrows(NotfoundException.class, () -> feature.upload(new SDSDelegatingWriteFeature(session, nodeid, session.getFeature(Write.class)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost()))); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback())); local.delete(); } @@ -151,7 +150,7 @@ public void testUploadBelowMultipartSize() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(random.length); final Node node = feature.upload(new SDSDelegatingWriteFeature(session, nodeid, session.getFeature(Write.class)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); assertTrue(new SDSFindFeature(session, nodeid).find(test)); final PathAttributes attributes = new SDSAttributesFinderFeature(session, nodeid).find(test); assertEquals(random.length, attributes.getSize()); @@ -175,7 +174,7 @@ public void testUploadExactMultipartSize() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(random.length); final Node node = feature.upload(new SDSDelegatingWriteFeature(session, nodeid, session.getFeature(Write.class)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); assertTrue(status.isComplete()); assertNotSame(PathAttributes.EMPTY, status.getResponse()); assertTrue(new SDSFindFeature(session, nodeid).find(test)); @@ -201,7 +200,7 @@ public void testUploadMultipleParts() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(random.length); final Node node = feature.upload(new SDSDelegatingWriteFeature(session, nodeid, session.getFeature(Write.class)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); assertTrue(status.isComplete()); assertNotSame(PathAttributes.EMPTY, status.getResponse()); assertTrue(new SDSFindFeature(session, nodeid).find(test)); @@ -230,7 +229,7 @@ public void testTripleCryptUploadBelowMultipartSize() throws Exception { final SDSEncryptionBulkFeature bulk = new SDSEncryptionBulkFeature(session, nodeid); bulk.pre(Transfer.Type.upload, Collections.singletonMap(new TransferItem(test, local), status), new DisabledConnectionCallback()); final Node node = feature.upload(session.getFeature(Write.class), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); assertTrue(status.isComplete()); assertNotSame(PathAttributes.EMPTY, status.getResponse()); assertTrue(new SDSFindFeature(session, nodeid).find(test)); @@ -269,7 +268,7 @@ public void testTripleCryptUploadExactMultipartSize() throws Exception { final SDSEncryptionBulkFeature bulk = new SDSEncryptionBulkFeature(session, nodeid); bulk.pre(Transfer.Type.upload, Collections.singletonMap(new TransferItem(test, local), status), new DisabledConnectionCallback()); final Node node = feature.upload(session.getFeature(Write.class), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); assertTrue(status.isComplete()); assertNotSame(PathAttributes.EMPTY, status.getResponse()); assertTrue(new SDSFindFeature(session, nodeid).find(test)); @@ -308,7 +307,7 @@ public void testTripleCryptUploadMultipleParts() throws Exception { final SDSEncryptionBulkFeature bulk = new SDSEncryptionBulkFeature(session, nodeid); bulk.pre(Transfer.Type.upload, Collections.singletonMap(new TransferItem(test, local), status), new DisabledConnectionCallback()); final Node node = feature.upload(session.getFeature(Write.class), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); assertTrue(status.isComplete()); assertNotSame(PathAttributes.EMPTY, status.getResponse()); assertTrue(new SDSFindFeature(session, nodeid).find(test)); diff --git a/dracoon/src/test/java/ch/cyberduck/core/sds/SDSReadFeatureTest.java b/dracoon/src/test/java/ch/cyberduck/core/sds/SDSReadFeatureTest.java index 06af7b4e418..5a63332ac5b 100644 --- a/dracoon/src/test/java/ch/cyberduck/core/sds/SDSReadFeatureTest.java +++ b/dracoon/src/test/java/ch/cyberduck/core/sds/SDSReadFeatureTest.java @@ -30,7 +30,6 @@ import ch.cyberduck.core.sds.io.swagger.client.model.Node; import ch.cyberduck.core.shared.DefaultUploadFeature; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -112,7 +111,7 @@ public void testReadRange() throws Exception { upload.setExists(true); new DefaultUploadFeature().upload( new SDSDirectS3MultipartWriteFeature(session, nodeid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), upload, - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); @@ -145,7 +144,7 @@ public void testReadRangeUnknownLength() throws Exception { upload.setExists(true); new DefaultUploadFeature().upload( new SDSDirectS3MultipartWriteFeature(session, nodeid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), upload, - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); final TransferStatus status = new TransferStatus(); status.setLength(-1L); status.setAppend(true); diff --git a/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxReadFeatureTest.java b/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxReadFeatureTest.java index d11aedda2f0..5935586863c 100644 --- a/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxReadFeatureTest.java +++ b/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxReadFeatureTest.java @@ -31,7 +31,6 @@ import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.shared.DefaultUploadFeature; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -95,7 +94,7 @@ public void testReadRange() throws Exception { new DefaultUploadFeature().upload( new DropboxWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); diff --git a/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxUploadFeatureTest.java b/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxUploadFeatureTest.java index 69009754fab..9cc2904b43f 100644 --- a/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxUploadFeatureTest.java +++ b/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxUploadFeatureTest.java @@ -26,9 +26,7 @@ import ch.cyberduck.core.exception.BackgroundException; import ch.cyberduck.core.features.Delete; import ch.cyberduck.core.io.BandwidthThrottle; -import ch.cyberduck.core.transfer.Transfer; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -65,7 +63,7 @@ public void testUploadSmall() throws Exception { status.setMime("text/plain"); final BytecountStreamListener count = new BytecountStreamListener(); final Metadata metadata = feature.upload(new DropboxWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), count, status, new DisabledLoginCallback()); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); assertTrue(new DropboxFindFeature(session).find(test)); @@ -82,9 +80,9 @@ public void testDecorate() throws Exception { final NullInputStream n = new NullInputStream(1L); assertSame(NullInputStream.class, new DropboxUploadFeature() { @Override - protected InputStream decorate(final InputStream in, final TransferStatus status, final UploadFilterOptions options) throws BackgroundException { - return super.decorate(in, status, options); + protected InputStream decorate(final InputStream in, final TransferStatus status) throws BackgroundException { + return super.decorate(in, status); } - }.decorate(n, new TransferStatus(), new UploadFilterOptions(session.getHost())).getClass()); + }.decorate(n, new TransferStatus()).getClass()); } } \ No newline at end of file diff --git a/eue/src/main/java/ch/cyberduck/core/eue/EueLargeUploadService.java b/eue/src/main/java/ch/cyberduck/core/eue/EueLargeUploadService.java index d147f24612d..a0950e546ea 100644 --- a/eue/src/main/java/ch/cyberduck/core/eue/EueLargeUploadService.java +++ b/eue/src/main/java/ch/cyberduck/core/eue/EueLargeUploadService.java @@ -39,8 +39,6 @@ import ch.cyberduck.core.transfer.SegmentRetryCallable; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; - import org.apache.commons.codec.DecoderException; import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Hex; @@ -80,7 +78,7 @@ public EueLargeUploadService(final EueSession session, final EueResourceIdProvid @Override public EueWriteFeature.Chunk upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { final ThreadPool pool = ThreadPoolFactory.get("multipart", concurrency); try { final List> parts = new ArrayList<>(); @@ -170,7 +168,7 @@ public EueWriteFeature.Chunk call() throws BackgroundException { status.setChecksum(write.checksum(file, status).compute(local.getInputStream(), status)); status.setUrl(url); final EueWriteFeature.Chunk chunk = EueLargeUploadService.this.transfer( - write, file, local, throttle, listener, status, overall, status, callback, new UploadFilterOptions(session.getHost())); + write, file, local, throttle, listener, status, overall, status, callback); log.info("Received response {} for part {}", chunk, partNumber); return chunk; } diff --git a/eue/src/main/java/ch/cyberduck/core/eue/EueSingleUploadService.java b/eue/src/main/java/ch/cyberduck/core/eue/EueSingleUploadService.java index 5c9b99a7cbb..ce665d79885 100644 --- a/eue/src/main/java/ch/cyberduck/core/eue/EueSingleUploadService.java +++ b/eue/src/main/java/ch/cyberduck/core/eue/EueSingleUploadService.java @@ -27,7 +27,6 @@ import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.StreamListener; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import java.util.Collections; @@ -45,7 +44,7 @@ public EueSingleUploadService(final EueSession session, final EueResourceIdProvi @Override public EueWriteFeature.Chunk upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { final String uploadUri; final String resourceId; if(status.isExists()) { @@ -62,7 +61,7 @@ public EueWriteFeature.Chunk upload(final Write write, fi status.setParameters(Collections.singletonMap(RESOURCE_ID, resourceId)); status.setUrl(uploadUri); status.setChecksum(write.checksum(file, status).compute(local.getInputStream(), status)); - return super.upload(write, file, local, throttle, progress, streamListener, status, callback, options); + return super.upload(write, file, local, throttle, progress, streamListener, status, callback); } } diff --git a/eue/src/main/java/ch/cyberduck/core/eue/EueThresholdUploadService.java b/eue/src/main/java/ch/cyberduck/core/eue/EueThresholdUploadService.java index ecfe67b7e92..08a5e0b59d5 100644 --- a/eue/src/main/java/ch/cyberduck/core/eue/EueThresholdUploadService.java +++ b/eue/src/main/java/ch/cyberduck/core/eue/EueThresholdUploadService.java @@ -30,7 +30,6 @@ import ch.cyberduck.core.io.StreamListener; import ch.cyberduck.core.preferences.HostPreferencesFactory; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.VaultRegistry; public class EueThresholdUploadService implements Upload { @@ -53,16 +52,16 @@ public EueThresholdUploadService(final EueSession session, final EueResourceIdPr @Override public EueWriteFeature.Chunk upload(final Write write, final Path file, Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback prompt, final UploadFilterOptions options) throws BackgroundException { + final TransferStatus status, final ConnectionCallback prompt) throws BackgroundException { if(status.getLength() >= threshold) { if(Vault.DISABLED == registry.find(session, file)) { // Only allow concurrent write of chunks when not uploading to vault. Write with default feature multiple 4MB chunks in parallel - return new EueLargeUploadService(session, fileid).upload(write, file, local, throttle, progress, streamListener, status, prompt, options); + return new EueLargeUploadService(session, fileid).upload(write, file, local, throttle, progress, streamListener, status, prompt); } // Write with multipart write feature for known file length sequentially 4MB chunks - return new EueUploadService().upload(write, file, local, throttle, progress, streamListener, status, prompt, options); + return new EueUploadService().upload(write, file, local, throttle, progress, streamListener, status, prompt); } // Write single chunk smaller than threshold - return new EueSingleUploadService(session, fileid).upload(write, file, local, throttle, progress, streamListener, status, prompt, options); + return new EueSingleUploadService(session, fileid).upload(write, file, local, throttle, progress, streamListener, status, prompt); } } diff --git a/eue/src/test/java/ch/cyberduck/core/cryptomator/EueSingleUploadServiceTest.java b/eue/src/test/java/ch/cyberduck/core/cryptomator/EueSingleUploadServiceTest.java index c838a53dd4e..883a1996c04 100644 --- a/eue/src/test/java/ch/cyberduck/core/cryptomator/EueSingleUploadServiceTest.java +++ b/eue/src/test/java/ch/cyberduck/core/cryptomator/EueSingleUploadServiceTest.java @@ -42,7 +42,6 @@ import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.StreamCopier; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.DefaultVaultRegistry; import ch.cyberduck.core.vault.VaultCredentials; import ch.cyberduck.test.IntegrationTest; @@ -87,7 +86,7 @@ public void testUploadVault() throws Exception { final CryptoUploadFeature feature = new CryptoUploadFeature<>(session, new EueSingleUploadService(session, fileid), cryptomator); - feature.upload(new CryptoWriteFeature<>(session, new EueWriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, null, new UploadFilterOptions(session.getHost())); + feature.upload(new CryptoWriteFeature<>(session, new EueWriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, null); assertEquals(content.length, count.getSent()); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new EueFindFeature(session, fileid)).find(test)); diff --git a/eue/src/test/java/ch/cyberduck/core/cryptomator/EueThresholdUploadServiceTest.java b/eue/src/test/java/ch/cyberduck/core/cryptomator/EueThresholdUploadServiceTest.java index 310b6f1a85d..9855b7e9cd1 100644 --- a/eue/src/test/java/ch/cyberduck/core/cryptomator/EueThresholdUploadServiceTest.java +++ b/eue/src/test/java/ch/cyberduck/core/cryptomator/EueThresholdUploadServiceTest.java @@ -45,7 +45,6 @@ import ch.cyberduck.core.transfer.Transfer; import ch.cyberduck.core.transfer.TransferItem; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.DefaultVaultRegistry; import ch.cyberduck.core.vault.VaultCredentials; import ch.cyberduck.test.IntegrationTest; @@ -93,7 +92,7 @@ public void testUploadVault() throws Exception { final CryptoUploadFeature feature = new CryptoUploadFeature<>(session, new EueThresholdUploadService(session, fileid, registry), cryptomator); - feature.upload(new CryptoWriteFeature<>(session, new EueWriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + feature.upload(new CryptoWriteFeature<>(session, new EueWriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, new DisabledConnectionCallback()); assertEquals(content.length, count.getSent()); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new EueFindFeature(session, fileid)).find(test)); @@ -130,7 +129,7 @@ public void testUploadVaultWithBulkFeature() throws Exception { final CryptoUploadFeature feature = new CryptoUploadFeature<>(session, new EueThresholdUploadService(session, fileid, registry), cryptomator); - feature.upload(new CryptoWriteFeature<>(session, new EueWriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + feature.upload(new CryptoWriteFeature<>(session, new EueWriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, new DisabledConnectionCallback()); assertEquals(content.length, count.getSent()); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new EueFindFeature(session, fileid)).find(test)); diff --git a/eue/src/test/java/ch/cyberduck/core/cryptomator/EueUploadServiceTest.java b/eue/src/test/java/ch/cyberduck/core/cryptomator/EueUploadServiceTest.java index 28c79af7240..9a4340dc52b 100644 --- a/eue/src/test/java/ch/cyberduck/core/cryptomator/EueUploadServiceTest.java +++ b/eue/src/test/java/ch/cyberduck/core/cryptomator/EueUploadServiceTest.java @@ -47,7 +47,6 @@ import ch.cyberduck.core.transfer.Transfer; import ch.cyberduck.core.transfer.TransferItem; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.DefaultVaultRegistry; import ch.cyberduck.core.vault.VaultCredentials; import ch.cyberduck.test.IntegrationTest; @@ -94,7 +93,7 @@ public void testUploadVault() throws Exception { final CryptoUploadFeature feature = new CryptoUploadFeature<>(session, new EueUploadService(), cryptomator); - feature.upload(new CryptoWriteFeature<>(session, new EueMultipartWriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + feature.upload(new CryptoWriteFeature<>(session, new EueMultipartWriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, new DisabledConnectionCallback()); assertEquals(content.length, count.getSent()); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new EueFindFeature(session, fileid)).find(test)); @@ -130,7 +129,7 @@ public void testUploadVaultWithBulkFeature() throws Exception { final CryptoUploadFeature feature = new CryptoUploadFeature<>(session, new EueUploadService(), cryptomator); - feature.upload(new CryptoWriteFeature<>(session, new EueMultipartWriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + feature.upload(new CryptoWriteFeature<>(session, new EueMultipartWriteFeature(session, fileid), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, new DisabledConnectionCallback()); assertEquals(content.length, count.getSent()); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new EueFindFeature(session, fileid)).find(test)); diff --git a/eue/src/test/java/ch/cyberduck/core/eue/EueCopyFeatureTest.java b/eue/src/test/java/ch/cyberduck/core/eue/EueCopyFeatureTest.java index 9cb9a307029..c23175252a6 100644 --- a/eue/src/test/java/ch/cyberduck/core/eue/EueCopyFeatureTest.java +++ b/eue/src/test/java/ch/cyberduck/core/eue/EueCopyFeatureTest.java @@ -30,7 +30,6 @@ import ch.cyberduck.core.shared.DefaultFindFeature; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -176,7 +175,7 @@ public void testCopyToExistingFile() throws Exception { final TransferStatus status = new TransferStatus().setLength(random.length); final EueWriteFeature.Chunk upload = new EueSingleUploadService(session, fileid).upload(new EueWriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); assertNotNull(upload.getResourceId()); local.delete(); assertTrue(new EueFindFeature(session, fileid).find(test)); diff --git a/eue/src/test/java/ch/cyberduck/core/eue/EueLargeUploadServiceTest.java b/eue/src/test/java/ch/cyberduck/core/eue/EueLargeUploadServiceTest.java index f9fa82cf625..c0a5992bc81 100644 --- a/eue/src/test/java/ch/cyberduck/core/eue/EueLargeUploadServiceTest.java +++ b/eue/src/test/java/ch/cyberduck/core/eue/EueLargeUploadServiceTest.java @@ -27,7 +27,6 @@ import ch.cyberduck.core.features.Delete; import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -57,7 +56,7 @@ public void testUploadLargeFileInChunks() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); - final EueWriteFeature.Chunk uploadResponse = s.upload(new EueWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + final EueWriteFeature.Chunk uploadResponse = s.upload(new EueWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback()); assertNotNull(uploadResponse.getCdash64()); assertEquals(content.length, count.getSent()); assertEquals(PathAttributes.EMPTY, status.getResponse()); diff --git a/eue/src/test/java/ch/cyberduck/core/eue/EueSingleUploadServiceTest.java b/eue/src/test/java/ch/cyberduck/core/eue/EueSingleUploadServiceTest.java index dc21673cc91..1736da5c842 100644 --- a/eue/src/test/java/ch/cyberduck/core/eue/EueSingleUploadServiceTest.java +++ b/eue/src/test/java/ch/cyberduck/core/eue/EueSingleUploadServiceTest.java @@ -26,7 +26,6 @@ import ch.cyberduck.core.features.Delete; import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -55,7 +54,7 @@ public void testUploadSimpleFile() throws Exception { IOUtils.write(content, local.getOutputStream(false)); final TransferStatus status = new TransferStatus().setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); - service.upload(new EueWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + service.upload(new EueWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback()); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); assertTrue(new EueFindFeature(session, fileid).find(file)); @@ -69,7 +68,7 @@ public void testUploadSimpleFile() throws Exception { IOUtils.write(content, local.getOutputStream(false)); final TransferStatus status = new TransferStatus().setLength(content.length).setExists(true); final BytecountStreamListener count = new BytecountStreamListener(); - service.upload(new EueWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + service.upload(new EueWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback()); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); assertTrue(new EueFindFeature(session, fileid).find(file)); diff --git a/eue/src/test/java/ch/cyberduck/core/eue/EueThresholdUploadServiceTest.java b/eue/src/test/java/ch/cyberduck/core/eue/EueThresholdUploadServiceTest.java index 6bd2dac3765..26357f821ec 100644 --- a/eue/src/test/java/ch/cyberduck/core/eue/EueThresholdUploadServiceTest.java +++ b/eue/src/test/java/ch/cyberduck/core/eue/EueThresholdUploadServiceTest.java @@ -26,7 +26,6 @@ import ch.cyberduck.core.features.Delete; import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.VaultRegistry; import ch.cyberduck.test.IntegrationTest; @@ -57,7 +56,7 @@ public void testUploadSimpleFile() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); - service.upload(new EueWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + service.upload(new EueWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback()); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); assertTrue(new EueFindFeature(session, fileid).find(file)); @@ -83,7 +82,7 @@ public void testUploadLargeFileInChunks() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); - service.upload(new EueWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + service.upload(new EueWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback()); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); assertTrue(new EueFindFeature(session, fileid).find(file)); diff --git a/eue/src/test/java/ch/cyberduck/core/eue/EueUploadServiceTest.java b/eue/src/test/java/ch/cyberduck/core/eue/EueUploadServiceTest.java index 0fbd3f329f3..e5b9717476f 100644 --- a/eue/src/test/java/ch/cyberduck/core/eue/EueUploadServiceTest.java +++ b/eue/src/test/java/ch/cyberduck/core/eue/EueUploadServiceTest.java @@ -26,7 +26,6 @@ import ch.cyberduck.core.features.Delete; import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -56,7 +55,7 @@ public void testUploadLargeFileInChunks() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); - final EueWriteFeature.Chunk uploadResponse = s.upload(new EueMultipartWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + final EueWriteFeature.Chunk uploadResponse = s.upload(new EueMultipartWriteFeature(session, fileid), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback()); assertNotNull(uploadResponse.getCdash64()); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); diff --git a/ftp/src/test/java/ch/cyberduck/core/shared/DefaultUploadFeatureTest.java b/ftp/src/test/java/ch/cyberduck/core/shared/DefaultUploadFeatureTest.java index f3fae565efb..9cbddc650fb 100644 --- a/ftp/src/test/java/ch/cyberduck/core/shared/DefaultUploadFeatureTest.java +++ b/ftp/src/test/java/ch/cyberduck/core/shared/DefaultUploadFeatureTest.java @@ -29,7 +29,6 @@ import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -62,14 +61,14 @@ public void testTransferAppend() throws Exception { final Void reply = new DefaultUploadFeature().upload( new FTPWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); } { final TransferStatus status = new TransferStatus().setLength(content.length / 2).setOffset(content.length / 2).setAppend(true); final Void reply = new DefaultUploadFeature().upload( new FTPWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); } final byte[] buffer = new byte[content.length]; final Read read = session.getFeature(Read.class); diff --git a/googledrive/src/test/java/ch/cyberduck/core/googledrive/DriveReadFeatureTest.java b/googledrive/src/test/java/ch/cyberduck/core/googledrive/DriveReadFeatureTest.java index b1b311e4164..a730b7a6572 100644 --- a/googledrive/src/test/java/ch/cyberduck/core/googledrive/DriveReadFeatureTest.java +++ b/googledrive/src/test/java/ch/cyberduck/core/googledrive/DriveReadFeatureTest.java @@ -30,7 +30,6 @@ import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.io.StreamCopier; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -80,7 +79,7 @@ public void testReadRange() throws Exception { new DriveUploadFeature().upload( new DriveWriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); diff --git a/googledrive/src/test/java/ch/cyberduck/core/googledrive/DriveUploadFeatureTest.java b/googledrive/src/test/java/ch/cyberduck/core/googledrive/DriveUploadFeatureTest.java index 88f38c777e2..e5c0461f0ff 100644 --- a/googledrive/src/test/java/ch/cyberduck/core/googledrive/DriveUploadFeatureTest.java +++ b/googledrive/src/test/java/ch/cyberduck/core/googledrive/DriveUploadFeatureTest.java @@ -27,7 +27,6 @@ import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -59,7 +58,7 @@ public void testWrite() throws Exception { final DriveFileIdProvider fileid = new DriveFileIdProvider(session); final DriveUploadFeature upload = new DriveUploadFeature(); upload.upload(new DriveWriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), - status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + status, new DisabledConnectionCallback()); test.attributes().setFileId(fileid.getFileId(test)); assertTrue(session.getFeature(Find.class).find(test)); assertEquals(content.length, new DriveListService(session, fileid).list(test.getParent(), new DisabledListProgressListener()).get(test).attributes().getSize(), 0L); diff --git a/googlestorage/src/test/java/ch/cyberduck/core/googlestorage/DefaultUploadFeatureTest.java b/googlestorage/src/test/java/ch/cyberduck/core/googlestorage/DefaultUploadFeatureTest.java index 61fcccdc8a9..4efb70c5a5d 100644 --- a/googlestorage/src/test/java/ch/cyberduck/core/googlestorage/DefaultUploadFeatureTest.java +++ b/googlestorage/src/test/java/ch/cyberduck/core/googlestorage/DefaultUploadFeatureTest.java @@ -28,7 +28,6 @@ import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.shared.DefaultUploadFeature; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -62,7 +61,7 @@ public void testUpload() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(random.length); final StorageObject versionId = m.upload(new GoogleStorageWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); assertTrue(new GoogleStorageFindFeature(session).find(test)); final PathAttributes attributes = new GoogleStorageListService(session).list(container, new DisabledListProgressListener()).find(new SimplePathPredicate(test)).attributes(); assertEquals(random.length, attributes.getSize()); diff --git a/irods/src/main/java/ch/cyberduck/core/irods/IRODSUploadFeature.java b/irods/src/main/java/ch/cyberduck/core/irods/IRODSUploadFeature.java index 2f563eaba52..987275f62cb 100644 --- a/irods/src/main/java/ch/cyberduck/core/irods/IRODSUploadFeature.java +++ b/irods/src/main/java/ch/cyberduck/core/irods/IRODSUploadFeature.java @@ -35,8 +35,6 @@ import ch.cyberduck.core.preferences.PreferencesFactory; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; - import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -65,7 +63,7 @@ public IRODSUploadFeature(final IRODSSession session) { @Override public Void upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, - final ConnectionCallback callback, final UploadFilterOptions uploadFilterOptions) throws BackgroundException { + final ConnectionCallback callback) throws BackgroundException { try { final IRODSFileSystemAO fs = session.getClient(); final IRODSFile f = fs.getIRODSFileFactory().instanceIRODSFile(file.getAbsolute()); diff --git a/irods/src/test/java/ch/cyberduck/core/irods/IRODSReadFeatureTest.java b/irods/src/test/java/ch/cyberduck/core/irods/IRODSReadFeatureTest.java index 7d887d81c14..724174cc3bd 100644 --- a/irods/src/test/java/ch/cyberduck/core/irods/IRODSReadFeatureTest.java +++ b/irods/src/test/java/ch/cyberduck/core/irods/IRODSReadFeatureTest.java @@ -38,7 +38,6 @@ import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader; import ch.cyberduck.core.shared.DefaultUploadFeature; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import ch.cyberduck.test.VaultTest; @@ -140,7 +139,7 @@ public void testReadRange() throws Exception { new DefaultUploadFeature().upload( new IRODSWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); diff --git a/irods/src/test/java/ch/cyberduck/core/irods/IRODSUploadFeatureTest.java b/irods/src/test/java/ch/cyberduck/core/irods/IRODSUploadFeatureTest.java index 0c80fc2770f..947a3ac28e5 100644 --- a/irods/src/test/java/ch/cyberduck/core/irods/IRODSUploadFeatureTest.java +++ b/irods/src/test/java/ch/cyberduck/core/irods/IRODSUploadFeatureTest.java @@ -36,7 +36,6 @@ import ch.cyberduck.core.proxy.DisabledProxyFinder; import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import ch.cyberduck.test.VaultTest; @@ -84,7 +83,7 @@ public void testAppend() throws Exception { new IRODSUploadFeature(session).upload( new IRODSWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); assertEquals(content.length / 2, count.getSent()); } { @@ -92,7 +91,7 @@ public void testAppend() throws Exception { new IRODSUploadFeature(session).upload( new IRODSWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); assertEquals(content.length / 2, status.getOffset()); } final byte[] buffer = new byte[content.length]; @@ -127,7 +126,7 @@ public void testWrite() throws Exception { final TransferStatus status = new TransferStatus().setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); new IRODSUploadFeature(session).upload( - new IRODSWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new IRODSWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback()); assertTrue(status.isComplete()); assertEquals(content.length, count.getSent()); final byte[] buffer = new byte[content.length]; @@ -168,7 +167,7 @@ public void sent(final long bytes) { } }, status, - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); try { status.validate(); fail(); diff --git a/manta/src/test/java/ch/cyberduck/core/manta/MantaReadFeatureTest.java b/manta/src/test/java/ch/cyberduck/core/manta/MantaReadFeatureTest.java index 751556eadc7..27333b9c832 100644 --- a/manta/src/test/java/ch/cyberduck/core/manta/MantaReadFeatureTest.java +++ b/manta/src/test/java/ch/cyberduck/core/manta/MantaReadFeatureTest.java @@ -28,7 +28,6 @@ import ch.cyberduck.core.io.StreamCopier; import ch.cyberduck.core.shared.DefaultUploadFeature; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -104,7 +103,7 @@ public void testReadRange() throws Exception { new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); @@ -137,7 +136,7 @@ public void testReadRangeUnknownLength() throws Exception { new DefaultUploadFeature().upload( new MantaWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); final TransferStatus status = new TransferStatus(); status.setLength(-1L); status.setAppend(true); diff --git a/onedrive/src/test/java/ch/cyberduck/core/onedrive/GraphReadFeatureTest.java b/onedrive/src/test/java/ch/cyberduck/core/onedrive/GraphReadFeatureTest.java index 7e36bff8ee0..81d15439914 100644 --- a/onedrive/src/test/java/ch/cyberduck/core/onedrive/GraphReadFeatureTest.java +++ b/onedrive/src/test/java/ch/cyberduck/core/onedrive/GraphReadFeatureTest.java @@ -32,7 +32,6 @@ import ch.cyberduck.core.onedrive.features.GraphWriteFeature; import ch.cyberduck.core.shared.DefaultUploadFeature; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -95,7 +94,7 @@ public void testReadRange() throws Exception { new DefaultUploadFeature().upload( new GraphWriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); @@ -138,7 +137,7 @@ public void testReadRangeUnknownLength() throws Exception { new DefaultUploadFeature().upload( new GraphWriteFeature(session, fileid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); final TransferStatus status = new TransferStatus(); status.setLength(-1L); status.setAppend(true); diff --git a/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftLargeObjectUploadFeature.java b/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftLargeObjectUploadFeature.java index 88b368702c9..a592b9c1349 100644 --- a/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftLargeObjectUploadFeature.java +++ b/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftLargeObjectUploadFeature.java @@ -45,8 +45,6 @@ import ch.cyberduck.core.transfer.SegmentRetryCallable; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; - import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -100,7 +98,7 @@ public StorageObject upload(final Write write, final Path file, f final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, - final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + final ConnectionCallback callback) throws BackgroundException { final ThreadPool pool = ThreadPoolFactory.get("multipart", concurrency); final List existingSegments = new ArrayList<>(); if(status.isAppend()) { @@ -147,7 +145,7 @@ public StorageObject upload(final Write write, final Path file, f } else { // Submit to queue - segments.add(this.submit(pool, write, segment, local, throttle, streamListener, status, offset, length, callback, options)); + segments.add(this.submit(pool, write, segment, local, throttle, streamListener, status, offset, length, callback)); log.debug("Segment {} submitted with size {} and offset {}", segment, length, offset); remaining -= length; offset += length; @@ -192,7 +190,7 @@ public StorageObject upload(final Write write, final Path file, f private Future submit(final ThreadPool pool, final Write write, final Path segment, final Local local, final BandwidthThrottle throttle, final StreamListener listener, - final TransferStatus overall, final Long offset, final Long length, final ConnectionCallback callback, final UploadFilterOptions options) throws ConnectionCanceledException { + final TransferStatus overall, final Long offset, final Long length, final ConnectionCallback callback) throws ConnectionCanceledException { overall.validate(); log.info("Submit part {} to queue with offset {} and length {}", segment, offset, length); final BytecountStreamListener counter = new BytecountStreamListener(listener); @@ -207,7 +205,7 @@ public StorageObject call() throws BackgroundException { status.setChecksum(write.checksum(segment, status).compute(local.getInputStream(), status)); status.setSegment(true); return SwiftLargeObjectUploadFeature.this.transfer( - write, segment, local, throttle, counter, status, overall, status, callback, options); + write, segment, local, throttle, counter, status, overall, status, callback); } }, overall, counter)); } diff --git a/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftThresholdUploadService.java b/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftThresholdUploadService.java index 6194487308b..fb8e52dcfae 100644 --- a/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftThresholdUploadService.java +++ b/openstack/src/main/java/ch/cyberduck/core/openstack/SwiftThresholdUploadService.java @@ -29,8 +29,6 @@ import ch.cyberduck.core.preferences.HostPreferencesFactory; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; - import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -65,7 +63,7 @@ public Write.Append append(final Path file, final TransferStatus status) throws @Override public StorageObject upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { final Upload feature; if(this.threshold(status)) { feature = new SwiftLargeObjectUploadFeature(session, regionService); @@ -73,7 +71,7 @@ public StorageObject upload(final Write write, final Path file, f else { feature = new SwiftSmallObjectUploadFeature(); } - return feature.upload(write, file, local, throttle, progress, streamListener, status, callback, options); + return feature.upload(write, file, local, throttle, progress, streamListener, status, callback); } protected boolean threshold(final TransferStatus status) { diff --git a/openstack/src/test/java/ch/cyberduck/core/cryptomator/SwiftLargeObjectUploadFeatureTest.java b/openstack/src/test/java/ch/cyberduck/core/cryptomator/SwiftLargeObjectUploadFeatureTest.java index 476c532fa9f..ad1f0386a56 100644 --- a/openstack/src/test/java/ch/cyberduck/core/cryptomator/SwiftLargeObjectUploadFeatureTest.java +++ b/openstack/src/test/java/ch/cyberduck/core/cryptomator/SwiftLargeObjectUploadFeatureTest.java @@ -41,7 +41,6 @@ import ch.cyberduck.core.openstack.SwiftRegionService; import ch.cyberduck.core.openstack.SwiftWriteFeature; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.DefaultVaultRegistry; import ch.cyberduck.core.vault.VaultCredentials; import ch.cyberduck.test.IntegrationTest; @@ -90,8 +89,8 @@ public void testLargeObjectUpload() throws Exception { writeStatus.setHeader(cryptomator.getFileHeaderCryptor().encryptHeader(header)); writeStatus.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); - service.upload(new CryptoWriteFeature<>(session, new SwiftWriteFeature(session, new SwiftRegionService(session)), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, null, - new UploadFilterOptions(session.getHost())); + service.upload(new CryptoWriteFeature<>(session, new SwiftWriteFeature(session, new SwiftRegionService(session)), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, null + ); assertEquals(content.length, count.getSent()); assertTrue(writeStatus.isComplete()); assertEquals(content.length, writeStatus.getResponse().getSize()); diff --git a/openstack/src/test/java/ch/cyberduck/core/openstack/SwiftLargeObjectUploadFeatureTest.java b/openstack/src/test/java/ch/cyberduck/core/openstack/SwiftLargeObjectUploadFeatureTest.java index 40df925005e..e289ea9dc77 100644 --- a/openstack/src/test/java/ch/cyberduck/core/openstack/SwiftLargeObjectUploadFeatureTest.java +++ b/openstack/src/test/java/ch/cyberduck/core/openstack/SwiftLargeObjectUploadFeatureTest.java @@ -23,7 +23,6 @@ import ch.cyberduck.core.io.StreamProgress; import ch.cyberduck.core.shared.DefaultAttributesFinderFeature; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -77,7 +76,7 @@ protected void beforeRead(int n) throws IOException { } }; } - }, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), listener, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + }, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), listener, status, new DisabledLoginCallback()); } catch(BackgroundException e) { // Expected @@ -92,7 +91,7 @@ protected void beforeRead(int n) throws IOException { new SwiftLargeObjectUploadFeature(session, new SwiftRegionService(session), 1 * 1024L * 1024L, 1).upload(new SwiftWriteFeature(session, new SwiftRegionService(session)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), append, - new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledLoginCallback()); assertEquals(content.length, append.getResponse().getSize()); assertTrue(new SwiftFindFeature(session).find(test)); assertEquals(content.length, new SwiftAttributesFinderFeature(session).find(test).getSize()); @@ -124,19 +123,19 @@ public void testAppendSecondPart() throws Exception { final SwiftLargeObjectUploadFeature feature = new SwiftLargeObjectUploadFeature(session, regionService, 1024L * 1024L, 1) { @Override - public StorageObject transfer(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final StreamCancelation cancel, final StreamProgress progress, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + public StorageObject transfer(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final StreamCancelation cancel, final StreamProgress progress, final ConnectionCallback callback) throws BackgroundException { if(!interrupt.get()) { if(status.getOffset() >= 1L * 1024L * 1024L) { throw new ConnectionTimeoutException("Test"); } } - return super.transfer(write, file, local, throttle, listener, status, cancel, progress, callback, options); + return super.transfer(write, file, local, throttle, listener, status, cancel, progress, callback); } }; final BytecountStreamListener listener = new BytecountStreamListener(); try { feature.upload(new SwiftWriteFeature(session, new SwiftRegionService(session)), test, new Local(System.getProperty("java.io.tmpdir"), name), - new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), listener, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), listener, status, new DisabledLoginCallback()); } catch(BackgroundException e) { // Expected @@ -153,7 +152,7 @@ public StorageObject transfer(final Write write, final Path file, final TransferStatus append = new TransferStatus().setAppend(true).setLength(1024L * 1024L).setOffset(1024L * 1024L); feature.upload(new SwiftWriteFeature(session, new SwiftRegionService(session)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), listener, append, - new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledLoginCallback()); assertEquals(2 * 1024L * 1024L, listener.getSent()); assertTrue(append.isComplete()); assertNotSame(PathAttributes.EMPTY, append.getResponse()); @@ -198,7 +197,7 @@ public void testUploadOverwrite() throws Exception { final BytecountStreamListener count = new BytecountStreamListener(); final StorageObject object = upload.upload(new SwiftWriteFeature(session, new SwiftRegionService(session)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, - status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + status, new DisabledConnectionCallback()); assertEquals(Checksum.NONE, Checksum.parse(object.getMd5sum())); assertNotEquals(Checksum.NONE, new SwiftAttributesFinderFeature(session).find(test).getChecksum()); assertNotNull(new DefaultAttributesFinderFeature(session).find(test).getChecksum().hash); @@ -251,7 +250,7 @@ public void testUploadOverwrite() throws Exception { final BytecountStreamListener count = new BytecountStreamListener(); upload.upload(new SwiftWriteFeature(session, regionService), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, - status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + status, new DisabledConnectionCallback()); assertTrue(status.isComplete()); assertEquals(content.length, status.getResponse().getSize()); diff --git a/openstack/src/test/java/ch/cyberduck/core/worker/SwiftSingleTransferWorkerTest.java b/openstack/src/test/java/ch/cyberduck/core/worker/SwiftSingleTransferWorkerTest.java index 0aaa74d18b7..151569e72c9 100644 --- a/openstack/src/test/java/ch/cyberduck/core/worker/SwiftSingleTransferWorkerTest.java +++ b/openstack/src/test/java/ch/cyberduck/core/worker/SwiftSingleTransferWorkerTest.java @@ -38,8 +38,15 @@ import ch.cyberduck.core.openstack.SwiftSession; import ch.cyberduck.core.ssl.DefaultX509KeyManager; import ch.cyberduck.core.ssl.DisabledX509TrustManager; -import ch.cyberduck.core.transfer.*; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; +import ch.cyberduck.core.transfer.DisabledTransferErrorCallback; +import ch.cyberduck.core.transfer.DisabledTransferPrompt; +import ch.cyberduck.core.transfer.Transfer; +import ch.cyberduck.core.transfer.TransferAction; +import ch.cyberduck.core.transfer.TransferItem; +import ch.cyberduck.core.transfer.TransferOptions; +import ch.cyberduck.core.transfer.TransferSpeedometer; +import ch.cyberduck.core.transfer.TransferStatus; +import ch.cyberduck.core.transfer.UploadTransfer; import ch.cyberduck.test.IntegrationTest; import ch.cyberduck.test.VaultTest; @@ -94,7 +101,7 @@ public T _getFeature(final Class type) { final SwiftRegionService regionService = new SwiftRegionService(this); return (T) new SwiftLargeObjectUploadFeature(this, regionService, 1024L * 1024L, 5) { @Override - protected InputStream decorate(final InputStream in, final TransferStatus status, final UploadFilterOptions options) { + protected InputStream decorate(final InputStream in, final TransferStatus status) { if(failed.get()) { // Second attempt successful return in; diff --git a/owncloud/src/test/java/ch/cyberduck/core/cryptomator/OcisUploadFeatureTest.java b/owncloud/src/test/java/ch/cyberduck/core/cryptomator/OcisUploadFeatureTest.java index 9a9091ae72a..8d697d3e176 100644 --- a/owncloud/src/test/java/ch/cyberduck/core/cryptomator/OcisUploadFeatureTest.java +++ b/owncloud/src/test/java/ch/cyberduck/core/cryptomator/OcisUploadFeatureTest.java @@ -42,7 +42,6 @@ import ch.cyberduck.core.owncloud.OwncloudAttributesFinderFeature; import ch.cyberduck.core.owncloud.OwncloudHomeFeature; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.tus.TusCapabilities; import ch.cyberduck.core.tus.TusWriteFeature; import ch.cyberduck.core.vault.DefaultVaultRegistry; @@ -94,7 +93,7 @@ public void testUploadVault() throws Exception { writeStatus.setLength(content.length); final Path test = new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); final BytecountStreamListener counter = new BytecountStreamListener(); - service.upload(new TusWriteFeature(capabilities, session.getClient()), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), counter, writeStatus, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + service.upload(new TusWriteFeature(capabilities, session.getClient()), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), counter, writeStatus, new DisabledConnectionCallback()); assertEquals(content.length, counter.getSent()); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new DAVFindFeature(session)).find(test)); diff --git a/owncloud/src/test/java/ch/cyberduck/core/owncloud/OcisUploadFeatureTest.java b/owncloud/src/test/java/ch/cyberduck/core/owncloud/OcisUploadFeatureTest.java index 78360d11f65..9c4b222e95b 100644 --- a/owncloud/src/test/java/ch/cyberduck/core/owncloud/OcisUploadFeatureTest.java +++ b/owncloud/src/test/java/ch/cyberduck/core/owncloud/OcisUploadFeatureTest.java @@ -35,7 +35,6 @@ import ch.cyberduck.core.io.SHA1ChecksumCompute; import ch.cyberduck.core.nextcloud.NextcloudWriteFeature; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.tus.TusCapabilities; import ch.cyberduck.core.tus.TusWriteFeature; import ch.cyberduck.test.IntegrationTest; @@ -75,7 +74,7 @@ public void testUploadLargeFileInChunks() throws Exception { status.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); assertFalse(feature.append(file, status).append); - final Void response = feature.upload(new TusWriteFeature(capabilities, session.getClient()), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + final Void response = feature.upload(new TusWriteFeature(capabilities, session.getClient()), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback()); assertTrue(status.isComplete()); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); @@ -97,7 +96,7 @@ public void testUploadLargeFileInChunks() throws Exception { status.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); assertFalse(feature.append(file, status).append); - final Void response = feature.upload(new TusWriteFeature(capabilities, session.getClient()), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + final Void response = feature.upload(new TusWriteFeature(capabilities, session.getClient()), file, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, new DisabledConnectionCallback()); assertTrue(status.isComplete()); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); diff --git a/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartUploadService.java b/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartUploadService.java index 9e0ea1f642d..9b9cf627cf5 100644 --- a/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartUploadService.java +++ b/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartUploadService.java @@ -44,8 +44,6 @@ import ch.cyberduck.core.transfer.SegmentRetryCallable; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; - import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpHeaders; import org.apache.logging.log4j.LogManager; @@ -97,7 +95,7 @@ public S3MultipartUploadService(final S3Session session, final S3AccessControlLi @Override public StorageObject upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { final ThreadPool pool = ThreadPoolFactory.get("multipart", concurrency); try { MultipartUpload multipart = null; @@ -153,7 +151,7 @@ public StorageObject upload(final Write write, final Path file, f // Last part can be less than 5 MB. Adjust part size. final long length = Math.min(Math.max((size / (S3DefaultMultipartService.MAXIMUM_UPLOAD_PARTS - 1)), partsize), remaining); // Submit to queue - parts.add(this.submit(pool, write, file, local, throttle, streamListener, status, multipart, partNumber, offset, length, callback, options)); + parts.add(this.submit(pool, write, file, local, throttle, streamListener, status, multipart, partNumber, offset, length, callback)); remaining -= length; offset += length; } @@ -210,7 +208,7 @@ public StorageObject upload(final Write write, final Path file, f private Future submit(final ThreadPool pool, final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus overall, final MultipartUpload multipart, - final int partNumber, final long offset, final long length, final ConnectionCallback callback, final UploadFilterOptions options) throws ConnectionCanceledException { + final int partNumber, final long offset, final long length, final ConnectionCallback callback) throws ConnectionCanceledException { overall.validate(); log.info("Submit part {} of {} to queue with offset {} and length {}", partNumber, file, offset, length); final BytecountStreamListener counter = new BytecountStreamListener(listener); @@ -241,7 +239,7 @@ public MultipartPart call() throws BackgroundException { status.setMetadata(metadata); } final StorageObject part = S3MultipartUploadService.this.transfer( - write, file, local, throttle, counter, status, overall, status, callback, options); + write, file, local, throttle, counter, status, overall, status, callback); log.info("Received response {} for part number {}", part, partNumber); // Populate part with response data that is accessible via the object's metadata return new MultipartPart(partNumber, diff --git a/s3/src/main/java/ch/cyberduck/core/s3/S3SingleUploadService.java b/s3/src/main/java/ch/cyberduck/core/s3/S3SingleUploadService.java index b27a5814b2e..312d59e86e8 100644 --- a/s3/src/main/java/ch/cyberduck/core/s3/S3SingleUploadService.java +++ b/s3/src/main/java/ch/cyberduck/core/s3/S3SingleUploadService.java @@ -31,8 +31,6 @@ import ch.cyberduck.core.io.StreamListener; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; - import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.jets3t.service.model.StorageObject; @@ -48,7 +46,7 @@ public S3SingleUploadService(final S3Session session) { @Override public StorageObject upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, - final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { final S3Protocol.AuthenticationHeaderSignatureVersion signatureVersion = session.getSignatureVersion(); switch(signatureVersion) { case AWS4HMACSHA256: @@ -59,7 +57,7 @@ public StorageObject upload(final Write write, final Path file, f break; } try { - final StorageObject response = super.upload(write, file, local, throttle, progress, streamListener, status, callback, options); + final StorageObject response = super.upload(write, file, local, throttle, progress, streamListener, status, callback); if(null != response.getServerSideEncryptionAlgorithm()) { log.warn("Skip checksum verification for {} with server side encryption enabled", file); status.setChecksum(Checksum.NONE); @@ -70,7 +68,7 @@ public StorageObject upload(final Write write, final Path file, f if(!session.getSignatureVersion().equals(signatureVersion)) { // Retry if upload fails with Header "x-amz-content-sha256" set to the hex-encoded SHA256 hash of the // request payload is required for AWS Version 4 request signing - return this.upload(write, file, local, throttle, progress, streamListener, status, callback, options); + return this.upload(write, file, local, throttle, progress, streamListener, status, callback); } throw e; } diff --git a/s3/src/main/java/ch/cyberduck/core/s3/S3ThresholdUploadService.java b/s3/src/main/java/ch/cyberduck/core/s3/S3ThresholdUploadService.java index c1bfbee7211..e1026a1073d 100644 --- a/s3/src/main/java/ch/cyberduck/core/s3/S3ThresholdUploadService.java +++ b/s3/src/main/java/ch/cyberduck/core/s3/S3ThresholdUploadService.java @@ -32,8 +32,6 @@ import ch.cyberduck.core.preferences.HostPreferencesFactory; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; - import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.jets3t.service.model.StorageObject; @@ -65,16 +63,16 @@ public Write.Append append(final Path file, final TransferStatus status) throws @Override public StorageObject upload(final Write write, final Path file, Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback prompt, final UploadFilterOptions options) throws BackgroundException { + final TransferStatus status, final ConnectionCallback prompt) throws BackgroundException { if(this.threshold(status)) { try { - return new S3MultipartUploadService(session, acl).upload(write, file, local, throttle, progress, streamListener, status, prompt, options); + return new S3MultipartUploadService(session, acl).upload(write, file, local, throttle, progress, streamListener, status, prompt); } catch(NotfoundException | InteroperabilityException e) { log.warn("Failure {} using multipart upload. Fallback to single upload.", e.getMessage()); status.setAppend(false); try { - return new S3SingleUploadService(session).upload(write, file, local, throttle, progress, streamListener, status, prompt, options); + return new S3SingleUploadService(session).upload(write, file, local, throttle, progress, streamListener, status, prompt); } catch(BackgroundException f) { log.warn("Failure {} using single upload. Throw original multipart failure {}", e, e); @@ -83,7 +81,7 @@ public StorageObject upload(final Write write, final Path file, L } } // Use single upload service - return new S3SingleUploadService(session).upload(write, file, local, throttle, progress, streamListener, status, prompt, options); + return new S3SingleUploadService(session).upload(write, file, local, throttle, progress, streamListener, status, prompt); } protected boolean threshold(final TransferStatus status) { diff --git a/s3/src/test/java/ch/cyberduck/core/cryptomator/S3MultipartUploadServiceTest.java b/s3/src/test/java/ch/cyberduck/core/cryptomator/S3MultipartUploadServiceTest.java index 5f92d0dd7b6..c53c19e2b46 100644 --- a/s3/src/test/java/ch/cyberduck/core/cryptomator/S3MultipartUploadServiceTest.java +++ b/s3/src/test/java/ch/cyberduck/core/cryptomator/S3MultipartUploadServiceTest.java @@ -45,7 +45,6 @@ import ch.cyberduck.core.transfer.Transfer; import ch.cyberduck.core.transfer.TransferItem; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.DefaultVaultRegistry; import ch.cyberduck.core.vault.VaultCredentials; import ch.cyberduck.test.IntegrationTest; @@ -95,7 +94,7 @@ public void testUploadSinglePart() throws Exception { writeStatus.setHeader(cryptomator.getFileHeaderCryptor().encryptHeader(header)); writeStatus.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); - m.upload(new CryptoWriteFeature<>(session, new S3WriteFeature(session, acl), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, null, new UploadFilterOptions(session.getHost())); + m.upload(new CryptoWriteFeature<>(session, new S3WriteFeature(session, acl), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, null); assertEquals(content.length, count.getSent()); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new S3FindFeature(session, acl)).find(test)); @@ -129,7 +128,7 @@ public void testUpload() throws Exception { final FileHeader header = cryptomator.getFileHeaderCryptor().create(); writeStatus.setHeader(cryptomator.getFileHeaderCryptor().encryptHeader(header)); writeStatus.setLength(content.length); - m.upload(new CryptoWriteFeature<>(session, new S3WriteFeature(session, acl), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), writeStatus, null, new UploadFilterOptions(session.getHost())); + m.upload(new CryptoWriteFeature<>(session, new S3WriteFeature(session, acl), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), writeStatus, null); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new S3FindFeature(session, acl)).find(test)); assertEquals(content.length, cryptomator.getFeature(session, AttributesFinder.class, new S3AttributesFinderFeature(session, acl)).find(test).getSize()); @@ -162,7 +161,7 @@ public void testUploadWithBulk() throws Exception { cryptomator); final Local local = new Local(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString()); IOUtils.write(content, local.getOutputStream(false)); - m.upload(new CryptoWriteFeature<>(session, new S3WriteFeature(session, acl), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), writeStatus, null, new UploadFilterOptions(session.getHost())); + m.upload(new CryptoWriteFeature<>(session, new S3WriteFeature(session, acl), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), writeStatus, null); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new S3FindFeature(session, acl)).find(test)); assertEquals(content.length, cryptomator.getFeature(session, AttributesFinder.class, new S3AttributesFinderFeature(session, acl)).find(test).getSize()); diff --git a/s3/src/test/java/ch/cyberduck/core/cryptomator/S3SingleUploadServiceTest.java b/s3/src/test/java/ch/cyberduck/core/cryptomator/S3SingleUploadServiceTest.java index 14cbb8d31f4..9a5395beac7 100644 --- a/s3/src/test/java/ch/cyberduck/core/cryptomator/S3SingleUploadServiceTest.java +++ b/s3/src/test/java/ch/cyberduck/core/cryptomator/S3SingleUploadServiceTest.java @@ -40,7 +40,6 @@ import ch.cyberduck.core.s3.S3SingleUploadService; import ch.cyberduck.core.s3.S3WriteFeature; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.DefaultVaultRegistry; import ch.cyberduck.core.vault.VaultCredentials; import ch.cyberduck.test.IntegrationTest; @@ -87,7 +86,7 @@ public void testUploadVault() throws Exception { final CryptoUploadFeature m = new CryptoUploadFeature<>(session, new S3SingleUploadService(session), cryptomator); - m.upload(new CryptoWriteFeature<>(session, new S3WriteFeature(session, acl), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, null, new UploadFilterOptions(session.getHost())); + m.upload(new CryptoWriteFeature<>(session, new S3WriteFeature(session, acl), cryptomator), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, writeStatus, null); assertEquals(content.length, count.getSent()); assertTrue(writeStatus.isComplete()); assertTrue(cryptomator.getFeature(session, Find.class, new S3FindFeature(session, acl)).find(test)); diff --git a/s3/src/test/java/ch/cyberduck/core/s3/S3MultipartUploadServiceTest.java b/s3/src/test/java/ch/cyberduck/core/s3/S3MultipartUploadServiceTest.java index ac89d062eee..e9ccb568b44 100644 --- a/s3/src/test/java/ch/cyberduck/core/s3/S3MultipartUploadServiceTest.java +++ b/s3/src/test/java/ch/cyberduck/core/s3/S3MultipartUploadServiceTest.java @@ -26,7 +26,6 @@ import ch.cyberduck.core.io.StreamProgress; import ch.cyberduck.core.kms.KMSEncryptionFeature; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -64,7 +63,7 @@ public void testUploadSinglePart() throws Exception { status.setStorageClass(S3Object.STORAGE_CLASS_REDUCED_REDUNDANCY); final BytecountStreamListener count = new BytecountStreamListener(); service.upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), count, status, new DisabledLoginCallback()); assertEquals(random.length, count.getSent()); assertSame(Checksum.NONE, status.getResponse().getChecksum()); assertTrue(status.isComplete()); @@ -99,7 +98,7 @@ public void testUploadBucketInHostname() throws Exception { status.setStorageClass(S3Object.STORAGE_CLASS_REDUCED_REDUNDANCY); final BytecountStreamListener count = new BytecountStreamListener(); service.upload(new S3WriteFeature(virtualhost, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), count, status, new DisabledLoginCallback()); assertEquals(random.length, count.getSent()); assertSame(Checksum.NONE, status.getResponse().getChecksum()); assertTrue(status.isComplete()); @@ -136,7 +135,7 @@ public void testUploadSinglePartEncrypted() throws Exception { status.setStorageClass(S3Object.STORAGE_CLASS_REDUCED_REDUNDANCY); final BytecountStreamListener count = new BytecountStreamListener(); service.upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), count, status, new DisabledLoginCallback()); assertEquals(random.length, count.getSent()); assertSame(Checksum.NONE, status.getResponse().getChecksum()); assertEquals(random.length, status.getResponse().getSize()); @@ -160,8 +159,8 @@ public void testUploadInvalidContainer() throws Exception { final Path test = new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); final Local local = new Local(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString()); final TransferStatus status = new TransferStatus(); - m.upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, null, - new UploadFilterOptions(session.getHost())); + m.upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, null + ); } @Test @@ -178,8 +177,8 @@ public void testMultipleParts() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(content.length); final BytecountStreamListener count = new BytecountStreamListener(); - m.upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, null, - new UploadFilterOptions(session.getHost())); + m.upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, null + ); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); assertNotSame(PathAttributes.EMPTY, status.getResponse()); @@ -204,7 +203,7 @@ public void testMultiplePartsWithSHA256Checksum() throws Exception { status.setLength(content.length); status.setModified(System.currentTimeMillis()); final BytecountStreamListener count = new BytecountStreamListener(); - m.upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, null, new UploadFilterOptions(session.getHost())); + m.upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, null); assertEquals(content.length, count.getSent()); assertTrue(status.isComplete()); assertNotSame(PathAttributes.EMPTY, status.getResponse()); @@ -233,17 +232,17 @@ public void testAppendSecondPart() throws Exception { final S3AccessControlListFeature acl = new S3AccessControlListFeature(session); final S3MultipartUploadService feature = new S3MultipartUploadService(session, acl, 10L * 1024L * 1024L, 1) { @Override - public StorageObject transfer(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final StreamCancelation cancel, final StreamProgress progress, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + public StorageObject transfer(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final StreamCancelation cancel, final StreamProgress progress, final ConnectionCallback callback) throws BackgroundException { if(status.getOffset() >= 10L * 1024L * 1024L) { throw new ConnectionTimeoutException("Test"); } - return super.transfer(write, file, local, throttle, listener, status, cancel, progress, callback, options); + return super.transfer(write, file, local, throttle, listener, status, cancel, progress, callback); } }; try { feature.upload(new S3WriteFeature(session, acl), test, new Local(System.getProperty("java.io.tmpdir"), name), new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, - new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledLoginCallback()); } catch(BackgroundException e) { // Expected @@ -260,7 +259,7 @@ public StorageObject transfer(final Write write, final Path file, final TransferStatus append = new TransferStatus().setAppend(true).setLength(2L * 1024L * 1024L).setOffset(10L * 1024L * 1024L); new S3MultipartUploadService(session, acl, 10L * 1024L * 1024L, 1).upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, append, - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); assertEquals(12L * 1024L * 1024L, count.getSent()); assertTrue(append.isComplete()); assertNotSame(PathAttributes.EMPTY, append.getResponse()); @@ -304,7 +303,7 @@ protected void beforeRead(int n) throws IOException { }; } }, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, status, - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); } catch(BackgroundException e) { // Expected @@ -319,7 +318,7 @@ protected void beforeRead(int n) throws IOException { new S3MultipartUploadService(session, acl, 10485760L, 1).upload( new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), count, append, - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); assertEquals(32769L, count.getSent()); assertTrue(append.isComplete()); assertEquals(content.length, append.getResponse().getSize()); diff --git a/s3/src/test/java/ch/cyberduck/core/s3/S3SingleUploadServiceTest.java b/s3/src/test/java/ch/cyberduck/core/s3/S3SingleUploadServiceTest.java index 079200b8e3e..e73ea5180be 100644 --- a/s3/src/test/java/ch/cyberduck/core/s3/S3SingleUploadServiceTest.java +++ b/s3/src/test/java/ch/cyberduck/core/s3/S3SingleUploadServiceTest.java @@ -27,7 +27,6 @@ import ch.cyberduck.core.kms.KMSEncryptionFeature; import ch.cyberduck.core.local.LocalTouchFactory; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -40,7 +39,8 @@ import java.util.EnumSet; import java.util.UUID; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; @Category(IntegrationTest.class) public class S3SingleUploadServiceTest extends AbstractS3Test { @@ -61,7 +61,7 @@ public void testUpload() throws Exception { status.setLength(random.length); status.setMime("text/plain"); service.upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); assertTrue(new S3FindFeature(session, acl).find(test)); final PathAttributes attr = new S3AttributesFinderFeature(session, acl).find(test); assertEquals(status.getResponse().getChecksum(), attr.getChecksum()); @@ -87,7 +87,7 @@ public void testUploadSSE() throws Exception { status.setLength(random.length); status.setEncryption(KMSEncryptionFeature.SSE_KMS_DEFAULT); service.upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); assertTrue(new S3FindFeature(session, acl).find(test)); final PathAttributes attributes = new S3AttributesFinderFeature(session, acl).find(test); assertEquals(random.length, attributes.getSize()); @@ -110,7 +110,7 @@ public void testUploadWithSHA256Checksum() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(random.length); service.upload(new S3WriteFeature(session, acl), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledLoginCallback()); assertTrue(new S3FindFeature(session, acl).find(test)); final PathAttributes attributes = new S3AttributesFinderFeature(session, acl).find(test); assertEquals(random.length, attributes.getSize()); @@ -127,6 +127,6 @@ public void testUploadInvalidContainer() throws Exception { LocalTouchFactory.get().touch(local); final TransferStatus status = new TransferStatus(); m.upload(new S3WriteFeature(session, new S3AccessControlListFeature(session)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), - status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + status, new DisabledLoginCallback()); } } diff --git a/s3/src/test/java/ch/cyberduck/core/s3/S3ThresholdUploadServiceTest.java b/s3/src/test/java/ch/cyberduck/core/s3/S3ThresholdUploadServiceTest.java index 25dd1e27656..8a0981c2063 100644 --- a/s3/src/test/java/ch/cyberduck/core/s3/S3ThresholdUploadServiceTest.java +++ b/s3/src/test/java/ch/cyberduck/core/s3/S3ThresholdUploadServiceTest.java @@ -28,7 +28,6 @@ import ch.cyberduck.core.io.BandwidthThrottle; import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -55,7 +54,7 @@ public void testUploadInvalidContainer() throws Exception { final Path test = new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); final Local local = new NullLocal(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString()); final TransferStatus status = new TransferStatus().setLength(5 * 1024L); - m.upload(new S3WriteFeature(session, new S3AccessControlListFeature(session)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, null, new UploadFilterOptions(session.getHost())); + m.upload(new S3WriteFeature(session, new S3AccessControlListFeature(session)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, null); } @Test @@ -72,7 +71,7 @@ public void testUploadSinglePartEuCentral() throws Exception { status.setStorageClass(S3Object.STORAGE_CLASS_REDUCED_REDUNDANCY); final BytecountStreamListener count = new BytecountStreamListener(); service.upload(new S3WriteFeature(session, new S3AccessControlListFeature(session)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), count, status, new DisabledLoginCallback()); assertEquals(random.length, count.getSent(), 0L); assertTrue(status.isComplete()); assertTrue(new S3FindFeature(session, new S3AccessControlListFeature(session)).find(test)); @@ -97,7 +96,7 @@ public void testUploadSinglePartUsEast() throws Exception { status.setStorageClass(S3Object.STORAGE_CLASS_REDUCED_REDUNDANCY); final BytecountStreamListener count = new BytecountStreamListener(); service.upload(new S3WriteFeature(session, new S3AccessControlListFeature(session)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), count, status, new DisabledLoginCallback()); assertEquals(random.length, count.getSent()); assertTrue(status.isComplete()); assertTrue(new S3FindFeature(session, new S3AccessControlListFeature(session)).find(test)); @@ -123,7 +122,7 @@ public void testUploadZeroLength() throws Exception { status.setMime("text/plain"); final BytecountStreamListener count = new BytecountStreamListener(); service.upload(new S3WriteFeature(session, new S3AccessControlListFeature(session)), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), count, status, new DisabledLoginCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), count, status, new DisabledLoginCallback()); assertEquals(random.length, count.getSent()); assertTrue(status.isComplete()); assertTrue(new S3FindFeature(session, new S3AccessControlListFeature(session)).find(test)); diff --git a/s3/src/test/java/ch/cyberduck/core/worker/S3SingleTransferWorkerTest.java b/s3/src/test/java/ch/cyberduck/core/worker/S3SingleTransferWorkerTest.java index da91acdcb6c..cbb8596bf42 100644 --- a/s3/src/test/java/ch/cyberduck/core/worker/S3SingleTransferWorkerTest.java +++ b/s3/src/test/java/ch/cyberduck/core/worker/S3SingleTransferWorkerTest.java @@ -47,7 +47,6 @@ import ch.cyberduck.core.transfer.TransferSpeedometer; import ch.cyberduck.core.transfer.TransferStatus; import ch.cyberduck.core.transfer.UploadTransfer; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -147,7 +146,7 @@ public T _getFeature(final Class type) { if(type == Upload.class) { return (T) new S3MultipartUploadService(this, new S3AccessControlListFeature(this), 5 * 1024L * 1024L, 5) { @Override - protected InputStream decorate(final InputStream in, final TransferStatus status, final UploadFilterOptions options) { + protected InputStream decorate(final InputStream in, final TransferStatus status) { if(failed.get()) { // Second attempt successful return in; @@ -225,7 +224,7 @@ public T _getFeature(final Class type) { if(type == Upload.class) { return (T) new S3SingleUploadService(this) { @Override - protected InputStream decorate(final InputStream in, final TransferStatus status, final UploadFilterOptions options) { + protected InputStream decorate(final InputStream in, final TransferStatus status) { if(failed.get()) { // Second attempt successful return in; diff --git a/spectra/src/main/java/ch/cyberduck/core/spectra/SpectraUploadFeature.java b/spectra/src/main/java/ch/cyberduck/core/spectra/SpectraUploadFeature.java index 4f47ac410fd..d8981f9ae63 100644 --- a/spectra/src/main/java/ch/cyberduck/core/spectra/SpectraUploadFeature.java +++ b/spectra/src/main/java/ch/cyberduck/core/spectra/SpectraUploadFeature.java @@ -30,8 +30,6 @@ import ch.cyberduck.core.transfer.Transfer; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; - import org.jets3t.service.model.StorageObject; import java.util.List; @@ -46,7 +44,7 @@ public SpectraUploadFeature(final SpectraBulkService bulk) { @Override public StorageObject upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, - final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + final ProgressListener progress, final StreamListener streamListener, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { if(Checksum.NONE == status.getChecksum()) { // The client-side checksum is passed to the BlackPearl gateway by supplying the applicable CRC HTTP header. // If this is done, the BlackPearl gateway verifies that the data received matches the checksum provided. @@ -61,7 +59,7 @@ public StorageObject upload(final Write write, final Path file, f StorageObject stored = null; for(TransferStatus chunk : chunks) { chunk.setChecksum(ChecksumComputeFactory.get(HashAlgorithm.md5).compute(local.getInputStream(), chunk)); - stored = super.upload(write, file, local, throttle, progress, streamListener, chunk, callback, options); + stored = super.upload(write, file, local, throttle, progress, streamListener, chunk, callback); } return stored; } diff --git a/spectra/src/test/java/ch/cyberduck/core/spectra/SpectraUploadFeatureTest.java b/spectra/src/test/java/ch/cyberduck/core/spectra/SpectraUploadFeatureTest.java index 52197fd7845..cc07f2fcba7 100644 --- a/spectra/src/test/java/ch/cyberduck/core/spectra/SpectraUploadFeatureTest.java +++ b/spectra/src/test/java/ch/cyberduck/core/spectra/SpectraUploadFeatureTest.java @@ -27,7 +27,6 @@ import ch.cyberduck.core.transfer.Transfer; import ch.cyberduck.core.transfer.TransferItem; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -63,7 +62,7 @@ public void testUpload() throws Exception { bulk.pre(Transfer.Type.upload, Collections.singletonMap(new TransferItem(test), writeStatus), new DisabledConnectionCallback()); final SpectraUploadFeature upload = new SpectraUploadFeature(new SpectraBulkService(session)); upload.upload(new SpectraWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), - writeStatus, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + writeStatus, new DisabledConnectionCallback()); final byte[] buffer = new byte[content.length]; final TransferStatus readStatus = new TransferStatus().setLength(content.length); bulk.pre(Transfer.Type.download, Collections.singletonMap(new TransferItem(test), readStatus), new DisabledConnectionCallback()); @@ -108,9 +107,9 @@ public void testUploadMultipleFiles() throws Exception { bulk.pre(Transfer.Type.upload, files, new DisabledConnectionCallback()); final SpectraUploadFeature upload = new SpectraUploadFeature(new SpectraBulkService(session)); upload.upload(new SpectraWriteFeature(session), test1, local1, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), - status1, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + status1, new DisabledConnectionCallback()); upload.upload(new SpectraWriteFeature(session), test2, local2, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), - status2, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + status2, new DisabledConnectionCallback()); new SpectraDeleteFeature(session).delete(Arrays.asList(test1, test2), new DisabledLoginCallback(), new Delete.DisabledCallback()); local1.delete(); local2.delete(); diff --git a/ssh/src/test/java/ch/cyberduck/core/shared/DefaultUploadFeatureTest.java b/ssh/src/test/java/ch/cyberduck/core/shared/DefaultUploadFeatureTest.java index 919e334bd90..32f41bdffb9 100644 --- a/ssh/src/test/java/ch/cyberduck/core/shared/DefaultUploadFeatureTest.java +++ b/ssh/src/test/java/ch/cyberduck/core/shared/DefaultUploadFeatureTest.java @@ -30,7 +30,6 @@ import ch.cyberduck.core.sftp.SFTPHomeDirectoryService; import ch.cyberduck.core.sftp.SFTPWriteFeature; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -63,14 +62,14 @@ public void testTransferAppend() throws Exception { new DefaultUploadFeature().upload( new SFTPWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); } { final TransferStatus status = new TransferStatus().setLength(content.length / 2).setOffset(content.length / 2).setAppend(true); new DefaultUploadFeature().upload( new SFTPWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); } final byte[] buffer = new byte[content.length]; final Read read = session.getFeature(Read.class); diff --git a/storegate/src/test/java/ch/cyberduck/core/storegate/StoregateReadFeatureTest.java b/storegate/src/test/java/ch/cyberduck/core/storegate/StoregateReadFeatureTest.java index 06a597ea626..d7cabb91bd5 100644 --- a/storegate/src/test/java/ch/cyberduck/core/storegate/StoregateReadFeatureTest.java +++ b/storegate/src/test/java/ch/cyberduck/core/storegate/StoregateReadFeatureTest.java @@ -30,7 +30,6 @@ import ch.cyberduck.core.shared.DefaultUploadFeature; import ch.cyberduck.core.storegate.io.swagger.client.model.File; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -114,7 +113,7 @@ public void testReadRange() throws Exception { upload.setExists(true); new DefaultUploadFeature().upload( new StoregateWriteFeature(session, nodeid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), upload, - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); @@ -148,7 +147,7 @@ public void testReadRangeUnknownLength() throws Exception { upload.setExists(true); new DefaultUploadFeature().upload( new StoregateWriteFeature(session, nodeid), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), upload, - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); final TransferStatus status = new TransferStatus(); status.setLength(-1L); status.setAppend(true); diff --git a/tus/src/main/java/ch/cyberduck/core/tus/TusUploadFeature.java b/tus/src/main/java/ch/cyberduck/core/tus/TusUploadFeature.java index 09147380a0e..9f535b4e762 100644 --- a/tus/src/main/java/ch/cyberduck/core/tus/TusUploadFeature.java +++ b/tus/src/main/java/ch/cyberduck/core/tus/TusUploadFeature.java @@ -41,8 +41,6 @@ import ch.cyberduck.core.threading.DefaultRetryCallable; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; - import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.concurrent.ConcurrentUtils; @@ -87,7 +85,7 @@ public TusUploadFeature(final Host host, final DAVClient client, final TusCapabi @Override public Void upload(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final ProgressListener progress, final StreamListener streamListener, - final TransferStatus status, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { // In order to achieve parallel upload the Concatenation extension MAY be used. try { final List> chunks = new ArrayList<>(); @@ -141,7 +139,7 @@ public String handleResponse(final HttpResponse response) throws HttpResponseExc while(remaining > 0) { final long length = Math.min(preferences.getInteger("tus.chunk.size"), remaining); chunks.add(this.submit(write, file, local, throttle, streamListener, status, - uploadUrl, offset, length, callback, options)); + uploadUrl, offset, length, callback)); remaining -= length; offset += length; } @@ -163,7 +161,7 @@ public String handleResponse(final HttpResponse response) throws HttpResponseExc private Future submit(final Write write, final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus overall, final String uploadUrl, - final long offset, final long length, final ConnectionCallback callback, final UploadFilterOptions options) throws BackgroundException { + final long offset, final long length, final ConnectionCallback callback) throws BackgroundException { overall.validate(); log.info("Send part of {} with offset {} and length {}", file, offset, length); return ConcurrentUtils.constantFuture(new DefaultRetryCallable<>(host, new BackgroundExceptionCallable() { @@ -180,7 +178,7 @@ public Void call() throws BackgroundException { parameters.put(UPLOAD_URL, uploadUrl); status.setParameters(parameters); final Void response = TusUploadFeature.this.transfer( - write, file, local, throttle, listener, status, overall, status, callback, options); + write, file, local, throttle, listener, status, overall, status, callback); log.info("Received response {}", response); return null; } diff --git a/webdav/src/test/java/ch/cyberduck/core/dav/DAVLockFeatureTest.java b/webdav/src/test/java/ch/cyberduck/core/dav/DAVLockFeatureTest.java index 44250a12150..775557ede8a 100644 --- a/webdav/src/test/java/ch/cyberduck/core/dav/DAVLockFeatureTest.java +++ b/webdav/src/test/java/ch/cyberduck/core/dav/DAVLockFeatureTest.java @@ -28,7 +28,6 @@ import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -55,7 +54,7 @@ public void testLockNotSupported() throws Exception { final Path test = new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); final HttpUploadFeature upload = new DAVUploadFeature(); upload.upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback()); String lock = null; try { lock = new DAVLockFeature(session).lock(test); diff --git a/webdav/src/test/java/ch/cyberduck/core/dav/DAVReadFeatureTest.java b/webdav/src/test/java/ch/cyberduck/core/dav/DAVReadFeatureTest.java index 06fca8ceab3..18e788eac26 100644 --- a/webdav/src/test/java/ch/cyberduck/core/dav/DAVReadFeatureTest.java +++ b/webdav/src/test/java/ch/cyberduck/core/dav/DAVReadFeatureTest.java @@ -14,7 +14,6 @@ import ch.cyberduck.core.shared.DefaultDownloadFeature; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -59,7 +58,7 @@ public void testReadChunkedTransfer() throws Exception { new DAVUploadFeature().upload( new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); // Unknown length in status final TransferStatus status = new TransferStatus() { @Override @@ -107,7 +106,7 @@ public void testReadRange() throws Exception { new DAVUploadFeature().upload( new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); @@ -135,7 +134,7 @@ public void testReadRangeUnknownLength() throws Exception { new DAVUploadFeature().upload( new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); final TransferStatus status = new TransferStatus(); status.setLength(-1L); status.setAppend(true); diff --git a/webdav/src/test/java/ch/cyberduck/core/dav/DAVUploadFeatureTest.java b/webdav/src/test/java/ch/cyberduck/core/dav/DAVUploadFeatureTest.java index 32ea512c1c5..56cdb859d6f 100644 --- a/webdav/src/test/java/ch/cyberduck/core/dav/DAVUploadFeatureTest.java +++ b/webdav/src/test/java/ch/cyberduck/core/dav/DAVUploadFeatureTest.java @@ -30,7 +30,6 @@ import ch.cyberduck.core.local.DefaultLocalTouchFeature; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -60,7 +59,7 @@ public void testAccessDenied() throws Exception { new DAVUploadFeature().upload( new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); } catch(AccessDeniedException e) { assertEquals("Unexpected response (403 Forbidden). Please contact your web hosting service provider for assistance.", e.getDetail()); @@ -85,14 +84,14 @@ public void testAppend() throws Exception { new DAVUploadFeature().upload( new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); } { final TransferStatus status = new TransferStatus().setLength(content.length / 2).setOffset(content.length / 2).setAppend(true); new DAVUploadFeature().upload( new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), status, - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); } final byte[] buffer = new byte[content.length]; final InputStream in = new DAVReadFeature(session).read(test, new TransferStatus().setLength(content.length), new DisabledConnectionCallback()); diff --git a/webdav/src/test/java/ch/cyberduck/core/dav/DAVWriteFeatureTest.java b/webdav/src/test/java/ch/cyberduck/core/dav/DAVWriteFeatureTest.java index 50d5a5372e7..aa2b0184090 100644 --- a/webdav/src/test/java/ch/cyberduck/core/dav/DAVWriteFeatureTest.java +++ b/webdav/src/test/java/ch/cyberduck/core/dav/DAVWriteFeatureTest.java @@ -19,7 +19,6 @@ import ch.cyberduck.core.shared.DefaultAttributesFinderFeature; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -55,7 +54,7 @@ public void testReadWrite() throws Exception { final Path test = new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); final HttpUploadFeature upload = new DAVUploadFeature(); upload.upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback()); assertTrue(session.getFeature(Find.class).find(test)); assertEquals(content.length, new DAVListService(session).list(test.getParent(), new DisabledListProgressListener()).get(test).attributes().getSize(), 0L); assertEquals(content.length, new DAVUploadFeature().append(test, status.setRemote(new DAVAttributesFinderFeature(session).find(test))).offset, 0L); @@ -88,7 +87,7 @@ public void testReadWriteChunkedTransfer() throws Exception { final Path test = new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); final HttpUploadFeature upload = new DAVUploadFeature(); upload.upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback()); assertTrue(session.getFeature(Find.class).find(test)); assertEquals(content.length, new DAVListService(session).list(test.getParent(), new DisabledListProgressListener()).get(test).attributes().getSize(), 0L); assertEquals(content.length, new DAVUploadFeature().append(test, status.setRemote(new DAVAttributesFinderFeature(session).find(test))).offset, 0L); @@ -124,7 +123,7 @@ public void testReplaceContent() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(content.length); upload.upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback()); assertNotEquals(folderEtag, new DAVAttributesFinderFeature(session).find(folder).getETag()); } final PathAttributes attr1 = new DAVAttributesFinderFeature(session).find(test); @@ -138,7 +137,7 @@ public void testReplaceContent() throws Exception { final TransferStatus status = new TransferStatus(); status.setLength(content.length); upload.upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback()); assertEquals(folderEtag, new DAVAttributesFinderFeature(session).find(folder).getETag()); assertNotEquals(fileEtag, new DAVAttributesFinderFeature(session).find(test).getETag()); } diff --git a/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVLockFeatureTest.java b/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVLockFeatureTest.java index d5c367f6a7d..df6e00ea2ca 100644 --- a/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVLockFeatureTest.java +++ b/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVLockFeatureTest.java @@ -33,7 +33,6 @@ import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -63,7 +62,7 @@ public void testLock() throws Exception { final Path test = new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); final HttpUploadFeature upload = new DAVUploadFeature(); upload.upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), - new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledProgressListener(), new DisabledStreamListener(), status, new DisabledConnectionCallback()); final String lock = new DAVLockFeature(session).lock(test); assertTrue(new MicrosoftIISDAVFindFeature(session).find(test)); final PathAttributes attributes = new MicrosoftIISDAVListService(session, new MicrosoftIISDAVAttributesFinderFeature(session)).list(test.getParent(), new DisabledListProgressListener()).get(test).attributes(); diff --git a/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVReadFeatureTest.java b/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVReadFeatureTest.java index d9d0a44b497..7c053feafb4 100644 --- a/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVReadFeatureTest.java +++ b/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVReadFeatureTest.java @@ -31,7 +31,6 @@ import ch.cyberduck.core.io.StreamCopier; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -70,7 +69,7 @@ public void testReadConcurrency() throws Exception { new DAVUploadFeature().upload( new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); final ExecutorService service = Executors.newCachedThreadPool(); final BlockingQueue> queue = new LinkedBlockingQueue<>(); final CompletionService completion = new ExecutorCompletionService<>(service, queue); diff --git a/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVUploadFeatureTest.java b/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVUploadFeatureTest.java index b5c72d3d376..faabd188fe2 100644 --- a/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVUploadFeatureTest.java +++ b/webdav/src/test/java/ch/cyberduck/core/dav/microsoft/MicrosoftIISDAVUploadFeatureTest.java @@ -30,7 +30,6 @@ import ch.cyberduck.core.io.DisabledStreamListener; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -62,7 +61,7 @@ public void testUpload() throws Exception { new DAVUploadFeature().upload( new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); new DAVDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); local.delete(); } @@ -82,7 +81,7 @@ public void testUploadNoConnectionInPool() throws Exception { assertThrows(InteroperabilityException.class, () -> new DAVUploadFeature().upload( new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost()))); + new DisabledConnectionCallback())); local.delete(); } @@ -101,7 +100,7 @@ public void testZeroByteUploadNoConnectionInPool() throws Exception { new DAVUploadFeature().upload( new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), - new DisabledConnectionCallback(), new UploadFilterOptions(session.getHost())); + new DisabledConnectionCallback()); new DAVDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); local.delete(); } diff --git a/webdav/src/test/java/ch/cyberduck/core/worker/DAVConcurrentTransferWorkerTest.java b/webdav/src/test/java/ch/cyberduck/core/worker/DAVConcurrentTransferWorkerTest.java index 37706c930c0..5cbd45ab9cf 100644 --- a/webdav/src/test/java/ch/cyberduck/core/worker/DAVConcurrentTransferWorkerTest.java +++ b/webdav/src/test/java/ch/cyberduck/core/worker/DAVConcurrentTransferWorkerTest.java @@ -48,7 +48,6 @@ import ch.cyberduck.core.transfer.TransferOptions; import ch.cyberduck.core.transfer.TransferSpeedometer; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.core.vault.DefaultVaultRegistry; import ch.cyberduck.test.IntegrationTest; @@ -81,8 +80,8 @@ public void testLargeUpAndDownload() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DAVUploadFeature().upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), new DisabledConnectionCallback(), - new UploadFilterOptions(session.getHost())); + new DAVUploadFeature().upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), new DisabledConnectionCallback() + ); assertEquals(content.length, new DAVAttributesFinderFeature(session).find(test).getSize()); final Local localFile = new DefaultTemporaryFileService().create(test.getName()); final Transfer download = new DownloadTransfer(new Host(new TestProtocol()), Collections.singletonList(new TransferItem(test, localFile)), new NullFilter<>()); @@ -115,8 +114,8 @@ public void testDownloadTransferWithFailure() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DAVUploadFeature().upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), new DisabledConnectionCallback(), - new UploadFilterOptions(session.getHost())); + new DAVUploadFeature().upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), new DisabledConnectionCallback() + ); final AtomicBoolean failed = new AtomicBoolean(); final Host host = new Host(session.getHost()) { @Override diff --git a/webdav/src/test/java/ch/cyberduck/core/worker/DAVSingleTransferWorkerTest.java b/webdav/src/test/java/ch/cyberduck/core/worker/DAVSingleTransferWorkerTest.java index 4febe1d33f5..95528d9a70c 100644 --- a/webdav/src/test/java/ch/cyberduck/core/worker/DAVSingleTransferWorkerTest.java +++ b/webdav/src/test/java/ch/cyberduck/core/worker/DAVSingleTransferWorkerTest.java @@ -53,7 +53,6 @@ import ch.cyberduck.core.transfer.TransferOptions; import ch.cyberduck.core.transfer.TransferSpeedometer; import ch.cyberduck.core.transfer.TransferStatus; -import ch.cyberduck.core.transfer.upload.UploadFilterOptions; import ch.cyberduck.test.IntegrationTest; import org.apache.commons.io.IOUtils; @@ -84,8 +83,8 @@ public void testDownloadTransferWithFailure() throws Exception { assertNotNull(out); IOUtils.write(content, out); out.close(); - new DAVUploadFeature().upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), new DisabledConnectionCallback(), - new UploadFilterOptions(session.getHost())); + new DAVUploadFeature().upload(new DAVWriteFeature(session), test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledProgressListener(), new DisabledStreamListener(), new TransferStatus().setLength(content.length), new DisabledConnectionCallback() + ); final AtomicBoolean failed = new AtomicBoolean(); final Host host = new Host(session.getHost()) { @Override From 1bfa3129886f1e15fc93632111897e2301038c09 Mon Sep 17 00:00:00 2001 From: David Kocher Date: Tue, 2 Dec 2025 22:25:47 +0100 Subject: [PATCH 7/7] Fix typo. --- .../download/AbstractDownloadFilter.java | 2 +- .../transfer/upload/AbstractUploadFilter.java | 2 +- .../core/eue/EueLargeUploadService.java | 2 +- .../core/eue/EueMultipartWriteFeature.java | 2 +- .../src/main/resources/ar.lproj/Error.strings | Bin 3914 -> 3918 bytes .../src/main/resources/bg.lproj/Error.strings | Bin 4192 -> 4196 bytes .../src/main/resources/ca.lproj/Error.strings | Bin 4428 -> 4432 bytes .../src/main/resources/cs.lproj/Error.strings | Bin 4128 -> 4130 bytes .../src/main/resources/cy.lproj/Error.strings | Bin 4046 -> 4050 bytes .../src/main/resources/da.lproj/Error.strings | Bin 4188 -> 4190 bytes .../src/main/resources/de.lproj/Error.strings | Bin 4616 -> 4618 bytes .../src/main/resources/el.lproj/Error.strings | Bin 4520 -> 4522 bytes .../src/main/resources/en.lproj/Error.strings | Bin 4040 -> 4044 bytes .../src/main/resources/es.lproj/Error.strings | Bin 4490 -> 4492 bytes .../src/main/resources/et.lproj/Error.strings | Bin 4160 -> 4164 bytes .../src/main/resources/fi.lproj/Error.strings | Bin 4292 -> 4294 bytes .../src/main/resources/fr.lproj/Error.strings | Bin 4510 -> 4512 bytes .../src/main/resources/he.lproj/Error.strings | Bin 3952 -> 3956 bytes .../src/main/resources/hr.lproj/Error.strings | Bin 4378 -> 4380 bytes .../src/main/resources/hu.lproj/Error.strings | Bin 4302 -> 4304 bytes .../src/main/resources/it.lproj/Error.strings | Bin 4450 -> 4452 bytes .../src/main/resources/ja.lproj/Error.strings | Bin 3772 -> 3776 bytes .../src/main/resources/ka.lproj/Error.strings | Bin 4168 -> 4172 bytes .../src/main/resources/ko.lproj/Error.strings | Bin 3568 -> 3570 bytes .../src/main/resources/lv.lproj/Error.strings | Bin 4054 -> 4056 bytes .../src/main/resources/nl.lproj/Error.strings | Bin 4360 -> 4362 bytes .../src/main/resources/no.lproj/Error.strings | Bin 4126 -> 4130 bytes .../src/main/resources/pl.lproj/Error.strings | Bin 4318 -> 4320 bytes .../main/resources/pt_BR.lproj/Error.strings | Bin 4454 -> 4456 bytes .../main/resources/pt_PT.lproj/Error.strings | Bin 4438 -> 4440 bytes .../src/main/resources/ro.lproj/Error.strings | Bin 4086 -> 4090 bytes .../src/main/resources/ru.lproj/Error.strings | Bin 4298 -> 4300 bytes .../src/main/resources/sk.lproj/Error.strings | Bin 4192 -> 4194 bytes .../src/main/resources/sl.lproj/Error.strings | Bin 4288 -> 4292 bytes .../src/main/resources/sr.lproj/Error.strings | Bin 4300 -> 4304 bytes .../src/main/resources/sv.lproj/Error.strings | Bin 4174 -> 4176 bytes .../main/resources/ta_IN.lproj/Error.strings | Bin 4298 -> 4300 bytes .../src/main/resources/th.lproj/Error.strings | Bin 4044 -> 4048 bytes .../src/main/resources/tr.lproj/Error.strings | Bin 4112 -> 4114 bytes .../src/main/resources/uk.lproj/Error.strings | Bin 4130 -> 4132 bytes .../main/resources/zh_CN.lproj/Error.strings | Bin 3200 -> 3202 bytes .../main/resources/zh_TW.lproj/Error.strings | Bin 3348 -> 3352 bytes .../core/irods/IRODSUploadFeature.java | 2 +- .../core/s3/S3MultipartUploadService.java | 2 +- .../core/s3/S3MultipartWriteFeature.java | 2 +- 45 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/ch/cyberduck/core/transfer/download/AbstractDownloadFilter.java b/core/src/main/java/ch/cyberduck/core/transfer/download/AbstractDownloadFilter.java index 13718218343..270931ee9ad 100644 --- a/core/src/main/java/ch/cyberduck/core/transfer/download/AbstractDownloadFilter.java +++ b/core/src/main/java/ch/cyberduck/core/transfer/download/AbstractDownloadFilter.java @@ -354,7 +354,7 @@ public void complete(final Path file, final Local local, if(!checksum.equals(download)) { throw new ChecksumException( MessageFormat.format(LocaleFactory.localizedString("Download {0} failed", "Error"), file.getName()), - MessageFormat.format(LocaleFactory.localizedString("Mismatch between {2} checksum {0} of transfered data and {1} returned by the server", "Error"), + MessageFormat.format(LocaleFactory.localizedString("Mismatch between {2} checksum {0} of transferred data and {1} returned by the server", "Error"), download.algorithm.toString(), download.hash, checksum.hash, checksum.algorithm)); } } diff --git a/core/src/main/java/ch/cyberduck/core/transfer/upload/AbstractUploadFilter.java b/core/src/main/java/ch/cyberduck/core/transfer/upload/AbstractUploadFilter.java index 7cbefbdd385..63e3cebb7ee 100644 --- a/core/src/main/java/ch/cyberduck/core/transfer/upload/AbstractUploadFilter.java +++ b/core/src/main/java/ch/cyberduck/core/transfer/upload/AbstractUploadFilter.java @@ -386,7 +386,7 @@ public void complete(final Path file, final Local local, if(!checksum.equals(response)) { throw new ChecksumException( MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()), - MessageFormat.format(LocaleFactory.localizedString("Mismatch between {2} checksum {0} of transfered data and {1} returned by the server", "Error"), + MessageFormat.format(LocaleFactory.localizedString("Mismatch between {2} checksum {0} of transferred data and {1} returned by the server", "Error"), response.hash, checksum.hash, response.algorithm.toString())); } } diff --git a/eue/src/main/java/ch/cyberduck/core/eue/EueLargeUploadService.java b/eue/src/main/java/ch/cyberduck/core/eue/EueLargeUploadService.java index a0950e546ea..4bdd7ac2fcd 100644 --- a/eue/src/main/java/ch/cyberduck/core/eue/EueLargeUploadService.java +++ b/eue/src/main/java/ch/cyberduck/core/eue/EueLargeUploadService.java @@ -127,7 +127,7 @@ public EueWriteFeature.Chunk upload(final Write write, fi } else { throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()), - MessageFormat.format("Mismatch between {2} checksum {0} of transfered data and {1} returned by the server", + MessageFormat.format("Mismatch between {2} checksum {0} of transferred data and {1} returned by the server", cdash64, completedUploadResponse.getCdash64(), HashAlgorithm.cdash64)); } } diff --git a/eue/src/main/java/ch/cyberduck/core/eue/EueMultipartWriteFeature.java b/eue/src/main/java/ch/cyberduck/core/eue/EueMultipartWriteFeature.java index cb3eb0135ef..5dd382739bc 100644 --- a/eue/src/main/java/ch/cyberduck/core/eue/EueMultipartWriteFeature.java +++ b/eue/src/main/java/ch/cyberduck/core/eue/EueMultipartWriteFeature.java @@ -247,7 +247,7 @@ public void close() throws IOException { } else { throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()), - MessageFormat.format("Mismatch between {2} checksum {0} of transfered data and {1} returned by the server", + MessageFormat.format("Mismatch between {2} checksum {0} of transferred data and {1} returned by the server", cdash64, completedUploadResponse.getCdash64(), HashAlgorithm.cdash64)); } } diff --git a/i18n/src/main/resources/ar.lproj/Error.strings b/i18n/src/main/resources/ar.lproj/Error.strings index f6e84722fd748c984d2f085c0c07da995251b133..6f0ae5acd05a39ea388b76cad0773b5b053f3004 100644 GIT binary patch delta 16 YcmX>lcTR4D4DVzq-c6fN@is6505^jMB>(^b delta 20 ccmX>ncS>%94DaL%ynd5&c#}3?;H_f>09V-u=>Px# diff --git a/i18n/src/main/resources/bg.lproj/Error.strings b/i18n/src/main/resources/bg.lproj/Error.strings index 29ba6c62303460283d7d82429261d11cb16d9b2d..dc2aaf3837e4261d24d8c1aee856238ff80f0ae3 100644 GIT binary patch delta 16 YcmaE$@I+yQ7T;tIzD=8N@O3Z(06Vn?iU0rr delta 20 ccmaE&@IYaM7T@H1e14Ow_>wl?<7;CC0A0EWT>t<8 diff --git a/i18n/src/main/resources/ca.lproj/Error.strings b/i18n/src/main/resources/ca.lproj/Error.strings index e58788bfb93a1db35cfc70abf0a6eebc55f48cb1..75c8a5106e6e42d0067ac23a12bfb7a658ff34b4 100644 GIT binary patch delta 16 YcmX@3bU|r@82@Au{!N>Y@OLl*05{zREdT%j delta 20 ccmcbhbVg}|82{u`{C<(rD;%{RF09YXh?EnA( diff --git a/i18n/src/main/resources/cs.lproj/Error.strings b/i18n/src/main/resources/cs.lproj/Error.strings index 8ba280d4c05617822a2f233ee7fd14ae76059b6a..33dd5e4be6aa2c76375261163c05af44b07779ad 100644 GIT binary patch delta 12 TcmZ3Wut;IU4&Ke%c(a%QB8mjs delta 12 TcmZ3aus~tM4&KeXcr%y)BANu; diff --git a/i18n/src/main/resources/cy.lproj/Error.strings b/i18n/src/main/resources/cy.lproj/Error.strings index b9073a82ce51dd770d89c343fcf372e7256088fe..c3286bb9f450bba40dc0901a9482518990ba54e5 100644 GIT binary patch delta 16 YcmX>ne@TAB4BpApcsFf!he@1@8B;LsrcsFf!;Ok%n06q`~jsO4v delta 20 acmX>je?or4B;LtWcsBsC-{vWN7K{L1?g$nD diff --git a/i18n/src/main/resources/es.lproj/Error.strings b/i18n/src/main/resources/es.lproj/Error.strings index f64c467a6cb2c37d518aafbac5f6d2874d21fd6a..6def790a8e8e60c7baebc85a668a9e6b803ade63 100644 GIT binary patch delta 12 TcmeBD?or;r!M~Y}zl8|^8JGid delta 12 TcmeBC?o!^s!M~Y{zljL|8K?tv diff --git a/i18n/src/main/resources/et.lproj/Error.strings b/i18n/src/main/resources/et.lproj/Error.strings index b4b741a43becbc21ec237a0eb4167efe454e255f..cc39b09859b27d61c28d3b1baf9b12c27d9c30e5 100644 GIT binary patch delta 16 YcmX@0a71AP8{cFWzD=9A@bxeP05rh`;s5{u delta 20 ccmX@2a6n-L8{gzze14O|_>wm7;_G4r08@qskpKVy diff --git a/i18n/src/main/resources/fi.lproj/Error.strings b/i18n/src/main/resources/fi.lproj/Error.strings index 06d6edf67586e3b320e8a84a42f4ac777f53273a..bc82b7586e1ab5660a3a93a7c57ce681f9453d3b 100644 GIT binary patch delta 12 TcmX@2cua9a7vJU%J{u+gBWVPj delta 12 TcmX@6ctmkS7vJU{J}V{wBY6a# diff --git a/i18n/src/main/resources/fr.lproj/Error.strings b/i18n/src/main/resources/fr.lproj/Error.strings index 20245a1a1ee7754c7689d776d909adf38194b0d5..8b63fea535395400e7051ee370e2e8b6f12410f1 100644 GIT binary patch delta 12 TcmbQIyg+$_82@Gw{w^i}8}_>!0aB0U7q delta 12 TcmbQEG)rm2F22os_!5`^B25I+ diff --git a/i18n/src/main/resources/hu.lproj/Error.strings b/i18n/src/main/resources/hu.lproj/Error.strings index 835ae3eeecef4875b31234ac879b7f1201186255..4922acafa04704f0ef0c0a621e44899445d83e11 100644 GIT binary patch delta 12 TcmX@7ctLSP5Z~qizB(oVB4GrA delta 12 TcmcbhcusLc5Z~qyz8WR~B5?$S diff --git a/i18n/src/main/resources/it.lproj/Error.strings b/i18n/src/main/resources/it.lproj/Error.strings index 4082f18bf000867563b3cd90faa30d932764464f..125ba5f9ec68f80cb3f28756e31dee8070d21e05 100644 GIT binary patch delta 12 TcmaE)^h9X`8~9G=Oucs6bJ;w@qX06i84cK`qY delta 20 ccmX>gyGM4z9G=Mmynd74@FZ;x;4NST09fz`y8r+H diff --git a/i18n/src/main/resources/ka.lproj/Error.strings b/i18n/src/main/resources/ka.lproj/Error.strings index f45e2119bbcdd65955b7eb8db5d0bff0232fa713..f8845bf9d55d7483789fd4edbe3d94517d5eb10d 100644 GIT binary patch delta 16 YcmX@1a7JN+5Z`10zD=7C@O3Z(05-h_5&!@I delta 20 acmX@3a6(~&5Z`1Gz70U^w^@YWf)M~qwFVpj diff --git a/i18n/src/main/resources/ko.lproj/Error.strings b/i18n/src/main/resources/ko.lproj/Error.strings index eb9acd264a0142989edbf545bbddc1c7fe98ec9d..8796799bc9be86a86f9e9a7c6bccabfc71a5ed11 100644 GIT binary patch delta 12 Tcmew${YiR*3eRRGo^y-R9BX|U> diff --git a/i18n/src/main/resources/lv.lproj/Error.strings b/i18n/src/main/resources/lv.lproj/Error.strings index 3481063a703a1bef873f242104d253a512854a93..5c0262f186e30946321ee3091845ccbe79c40f40 100644 GIT binary patch delta 12 Tcmca6e?xx58Q#sOczKurCprZV delta 12 Tcmca1e@%YF8Q#t3c)6GWCrSkn diff --git a/i18n/src/main/resources/nl.lproj/Error.strings b/i18n/src/main/resources/nl.lproj/Error.strings index 94318a21a657629922f0250bf342e0b2c37bb503..644f0bb10e98bf116196c86e2175c2ba27acdeff 100644 GIT binary patch delta 12 TcmeBB>QdUUif{7@z62%!AN>T1 delta 12 TcmeBD>QLISif{88zBncTAPoeJ diff --git a/i18n/src/main/resources/no.lproj/Error.strings b/i18n/src/main/resources/no.lproj/Error.strings index 954594ce8ee9fea2b5e0ee2d279c28fe724900b8..edb25d0e766ea112ec9bba21f04624987848bc66 100644 GIT binary patch delta 16 YcmbQIut;IU7v9OAcsFfc#8<-z073Q#RsaA1 delta 20 ccmZ3aFi&B_7v9M$`1~fj@Fi_t!B@oy09uX*^Z)<= diff --git a/i18n/src/main/resources/pl.lproj/Error.strings b/i18n/src/main/resources/pl.lproj/Error.strings index d12b3322a145220fba0fe1b3aa7a261194ade7d8..c178b85eb01aac52cfe11663a3e212b679d88661 100644 GIT binary patch delta 12 Tcmcbo_&{+(7vJU%zAz>LCD{b( delta 12 TcmaE$cu#Rd7vJU{z7Qq=CFun0 diff --git a/i18n/src/main/resources/pt_BR.lproj/Error.strings b/i18n/src/main/resources/pt_BR.lproj/Error.strings index d94bbb4bde1002368aad7905634467e455b31bc0..44d5338e7c55a03c72213edfffd494690b3ac5d0 100644 GIT binary patch delta 12 TcmaE+^g?L^5C3K^{um|zAxH!W delta 12 TcmaE%^h{|35C3L9{wO8@Ay@T2 delta 12 TcmcbibWLf)2fodp_|ljFDboeK diff --git a/i18n/src/main/resources/ro.lproj/Error.strings b/i18n/src/main/resources/ro.lproj/Error.strings index 3dbdaa66333a4b9bdfed4ddffab53e679c44ae6f..a285daa6c5a7a0b38ec824e89af48a907d7fb3a9 100644 GIT binary patch delta 16 Ycmew+|4V+u0p7{`csFg%wl4@U<}l0AHpD-T(jq diff --git a/i18n/src/main/resources/ru.lproj/Error.strings b/i18n/src/main/resources/ru.lproj/Error.strings index b0df770dbcf90d0507206d2ca2a4370d856cb1da..a4f77881a40b84409a0b7ab8c0a977c8f6d5f9af 100644 GIT binary patch delta 12 TcmX@5ct&wU1mET`z7i$?A~ytl delta 12 TcmX@3cuH|Y1mET;z9J?7B1Z&% diff --git a/i18n/src/main/resources/sk.lproj/Error.strings b/i18n/src/main/resources/sk.lproj/Error.strings index 058ef77936219f92d9437f0a2c218c111089dae7..c1fa9e31c15453bd4e5a5776af47b9d5de20933e 100644 GIT binary patch delta 12 TcmaE$@JL~U8Q*3TJ{=|iA^`*% delta 12 TcmaE)@IYaM8Q*3LJ}o8yA`t`} diff --git a/i18n/src/main/resources/sl.lproj/Error.strings b/i18n/src/main/resources/sl.lproj/Error.strings index 64c95fcf255e0280b9e96d3ed61543f4f5a14ded..f6b1b3693feccc9a608362da2a75c1005cc47150 100644 GIT binary patch delta 16 XcmX@0ctmkS7vJO#zD=7g_&XQ@JhTRF delta 20 ccmX@2ctCMO7vE$%e!t1L_>wl;@wYJo09VWhp#T5? diff --git a/i18n/src/main/resources/sr.lproj/Error.strings b/i18n/src/main/resources/sr.lproj/Error.strings index 4405ad78107b3371d91d04f07dd321387a69db57..760f50e18daf4415cf34e5a71263cbe769e9de64 100644 GIT binary patch delta 16 YcmX@3ctLSP58vc2zD=90_$M&}06ty@l>h($ delta 20 ccmcbhct&wU58q@5e!t0g_>wj|@K0a_09p12%K!iX diff --git a/i18n/src/main/resources/sv.lproj/Error.strings b/i18n/src/main/resources/sv.lproj/Error.strings index 0e4ac82a0793e191e1ff21c0effaa36fd03fa990..78742aec8e59c594b865e2826c4f1fb2a05c4de5 100644 GIT binary patch delta 12 TcmX@7a6w^%6yIhEJ~Ji&A5{a$ delta 12 Tcmcbha86-^6yIhUJ`*MYA7ul| diff --git a/i18n/src/main/resources/ta_IN.lproj/Error.strings b/i18n/src/main/resources/ta_IN.lproj/Error.strings index 94e3b43175d050d5c7a74d5aa49a6332487c4571..8354ac7c8db286b5b14248eff99af2667193bd4b 100644 GIT binary patch delta 12 TcmX@5ct&x97vE+Nz9uFBA-M!@ delta 12 TcmX@3cuH}D7vE+dz6K@$A;|=A diff --git a/i18n/src/main/resources/th.lproj/Error.strings b/i18n/src/main/resources/th.lproj/Error.strings index d33bc9f48b3833483ae69d3eb6f84841959a67f9..ca7cd138e210a05852be47708a7af8797efcbeb8 100644 GIT binary patch delta 16 YcmX>je?fl3G~UTmcsFf!;p<=o06ydfq5uE@ delta 20 ccmca0e@1@8G~UTxe14Ok@g{Bd;%j3B09ySA;Q#;t diff --git a/i18n/src/main/resources/tr.lproj/Error.strings b/i18n/src/main/resources/tr.lproj/Error.strings index 9583499375513f8814f3950f1365e4572633ec98..cbc57697bf5134f19b903545a8985ba8e780c02a 100644 GIT binary patch delta 12 TcmbQBFiBy?dWjcfA{t}aFZA|M4N diff --git a/i18n/src/main/resources/zh_TW.lproj/Error.strings b/i18n/src/main/resources/zh_TW.lproj/Error.strings index 7c71073bd3f64cd4d2f3850eccddf8e833c6caac..21aa790f8360e7ff677f89f019c181fc87b9695c 100644 GIT binary patch delta 16 YcmbOtHA8BH5%**R?oFE?aGNj!05SOmp#T5? delta 19 ZcmbOsHAQNJ5%**h?hQcfH`#>e2>?N?2B!c3 diff --git a/irods/src/main/java/ch/cyberduck/core/irods/IRODSUploadFeature.java b/irods/src/main/java/ch/cyberduck/core/irods/IRODSUploadFeature.java index 987275f62cb..a5dbb866224 100644 --- a/irods/src/main/java/ch/cyberduck/core/irods/IRODSUploadFeature.java +++ b/irods/src/main/java/ch/cyberduck/core/irods/IRODSUploadFeature.java @@ -98,7 +98,7 @@ public Void upload(final Write write, final Path file, final Local local, final Checksum expected = ChecksumComputeFactory.get(fingerprint.algorithm).compute(local.getInputStream(), new TransferStatus(status)); if(!expected.equals(fingerprint)) { throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()), - MessageFormat.format("Mismatch between {2} checksum {0} of transfered data and {1} returned by the server", + MessageFormat.format("Mismatch between {2} checksum {0} of transferred data and {1} returned by the server", expected, fingerprint.hash, fingerprint.algorithm)); } } diff --git a/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartUploadService.java b/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartUploadService.java index 9b9cf627cf5..e1df5eca829 100644 --- a/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartUploadService.java +++ b/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartUploadService.java @@ -180,7 +180,7 @@ public StorageObject upload(final Write write, final Path file, f final String reference = StringUtils.remove(complete.getEtag(), "\""); if(!StringUtils.equalsIgnoreCase(expected, reference)) { throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()), - MessageFormat.format("Mismatch between {2} checksum {0} of transfered data and {1} returned by the server", + MessageFormat.format("Mismatch between {2} checksum {0} of transferred data and {1} returned by the server", expected, reference, HashAlgorithm.md5)); } } diff --git a/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartWriteFeature.java b/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartWriteFeature.java index c2cbe67c973..95e8a8dc363 100644 --- a/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartWriteFeature.java +++ b/s3/src/main/java/ch/cyberduck/core/s3/S3MultipartWriteFeature.java @@ -208,7 +208,7 @@ public void close() throws IOException { final String reference = StringUtils.remove(complete.getEtag(), "\""); if(!StringUtils.equalsIgnoreCase(expected, reference)) { throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()), - MessageFormat.format("Mismatch between {2} checksum {0} of transfered data and {1} returned by the server", + MessageFormat.format("Mismatch between {2} checksum {0} of transferred data and {1} returned by the server", expected, reference, HashAlgorithm.md5)); } }