Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ public <T> T getFeature(final Session<?> session, final Class<T> type, final T d
if(type == Symlink.class) {
return (T) new CryptoSymlinkFeature(session, (Symlink) delegate, this);
}
if(type == Headers.class) {
if(type == Headers.class || type == Metadata.class) {
return (T) new CryptoHeadersFeature(session, (Headers) delegate, this);
}
if(type == Compress.class) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ public <T> T getFeature(final Session<?> session, final Class<T> type, final T d
if(type == Symlink.class) {
return (T) new CryptoSymlinkFeature(session, (Symlink) delegate, this);
}
if(type == Headers.class) {
if(type == Headers.class || type == Metadata.class) {
return (T) new CryptoHeadersFeature(session, (Headers) delegate, this);
}
if(type == Compress.class) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public Acl getPermission(final Path file) throws BackgroundException {

@Override
public void setPermission(final Path file, final TransferStatus status) throws BackgroundException {
delegate.setPermission(vault.encrypt(session, file), status);
delegate.setPermission(vault.encrypt(session, file), new CryptoTransferStatus(vault, status));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public CryptoTransferStatus(final Vault vault, final TransferStatus proxy) {
public TransferStatus setResponse(final PathAttributes attributes) {
try {
attributes.setSize(vault.toCleartextSize(0L, attributes.getSize()));
attributes.setDisplayname(null);
super.setResponse(attributes);
}
catch(BackgroundException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public PathAttributes find(final Path file, final ListProgressListener listener)
if(file.isDirectory()) {
attributes.setSize(-1L);
}
return attributes;
return attributes.setDisplayname(null);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import ch.cyberduck.core.Path;
import ch.cyberduck.core.Session;
import ch.cyberduck.core.cryptomator.CryptoTransferStatus;
import ch.cyberduck.core.exception.BackgroundException;
import ch.cyberduck.core.features.Headers;
import ch.cyberduck.core.features.Vault;
Expand Down Expand Up @@ -49,7 +50,7 @@ public Map<String, String> getMetadata(final Path file) throws BackgroundExcepti

@Override
public void setMetadata(final Path file, final TransferStatus status) throws BackgroundException {
delegate.setMetadata(vault.encrypt(session, file, true), status);
delegate.setMetadata(vault.encrypt(session, file, true), new CryptoTransferStatus(vault, status));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import ch.cyberduck.core.Path;
import ch.cyberduck.core.Permission;
import ch.cyberduck.core.Session;
import ch.cyberduck.core.cryptomator.CryptoTransferStatus;
import ch.cyberduck.core.exception.BackgroundException;
import ch.cyberduck.core.features.UnixPermission;
import ch.cyberduck.core.features.Vault;
Expand Down Expand Up @@ -59,7 +60,7 @@ public Permission getUnixPermission(final Path file) throws BackgroundException

@Override
public void setUnixPermission(final Path file, final TransferStatus status) throws BackgroundException {
delegate.setUnixPermission(cryptomator.encrypt(session, file, true), status);
delegate.setUnixPermission(cryptomator.encrypt(session, file, true), new CryptoTransferStatus(cryptomator, status));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@

import ch.cyberduck.core.AlphanumericRandomStringService;
import ch.cyberduck.core.ConnectionCallback;
import ch.cyberduck.core.Credentials;
import ch.cyberduck.core.DisabledListProgressListener;
import ch.cyberduck.core.DisabledPasswordCallback;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.Local;
import ch.cyberduck.core.LoginCallback;
import ch.cyberduck.core.LoginOptions;
import ch.cyberduck.core.NullFilter;
import ch.cyberduck.core.PasswordCallback;
import ch.cyberduck.core.Path;
import ch.cyberduck.core.PathAttributes;
import ch.cyberduck.core.ProgressListener;
Expand Down Expand Up @@ -104,13 +102,10 @@ public void testUpload() throws Exception {
final OutputStream out2 = localFile2.getOutputStream(false);
IOUtils.write(content, out2);
out2.close();
final AbstractVault cryptomator = new DefaultVaultProvider(session).create(session, null, vault, new VaultVersion(vaultVersion), new VaultCredentials("test"));
final DefaultVaultRegistry vaults = new DefaultVaultRegistry(new DisabledPasswordCallback() {
@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("test");
}
});
final DefaultVaultProvider provider = new DefaultVaultProvider(session);
provider.create(session, null, vault, new VaultVersion(vaultVersion), new VaultCredentials("test"));
final DefaultVaultRegistry vaults = new DefaultVaultRegistry(PasswordCallback.noop);
final AbstractVault cryptomator = provider.load(session, vault, new VaultVersion(vaultVersion), new VaultCredentials("test"));
vaults.add(cryptomator);
session.withRegistry(vaults);
final Host host = new Host(new TestProtocol());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
import ch.cyberduck.core.Local;
import ch.cyberduck.core.LoginCallback;
import ch.cyberduck.core.NullFilter;
import ch.cyberduck.core.PasswordCallback;
import ch.cyberduck.core.Path;
import ch.cyberduck.core.PathAttributes;
import ch.cyberduck.core.ProgressListener;
import ch.cyberduck.core.TestProtocol;
import ch.cyberduck.core.cryptomator.features.CryptoReadFeature;
Expand Down Expand Up @@ -102,9 +104,9 @@ public void testUpload() throws Exception {
IOUtils.write(content, out2);
out2.close();
final DefaultVaultProvider provider = new DefaultVaultProvider(session);
final AbstractVault cryptomator = provider.create(session, null, vault, new VaultVersion(vaultVersion), new VaultCredentials("test"));
session.withRegistry(new DefaultVaultRegistry(new DisabledPasswordCallback(),
provider.load(session, cryptomator.getHome(), new VaultVersion(vaultVersion), new VaultCredentials("test"))));
provider.create(session, null, vault, new VaultVersion(vaultVersion), new VaultCredentials("test"));
final AbstractVault cryptomator = provider.load(session, vault, new VaultVersion(vaultVersion), new VaultCredentials("test"));
session.withRegistry(new DefaultVaultRegistry(PasswordCallback.noop, cryptomator));
final Transfer t = new UploadTransfer(new Host(new TestProtocol()), Collections.singletonList(new TransferItem(dir1, localDirectory1)), new NullFilter<>());
assertTrue(new SingleTransferWorker(session, session, t, new TransferOptions(), new TransferSpeedometer(t), new DisabledTransferPrompt() {
@Override
Expand All @@ -116,7 +118,9 @@ ProgressListener.noop, StreamListener.noop, LoginCallback.noop, new DisabledNoti

}.run(session));
assertTrue(cryptomator.getFeature(session, Find.class, new DAVFindFeature(session)).find(dir1));
assertEquals(content.length, cryptomator.getFeature(session, AttributesFinder.class, new DAVAttributesFinderFeature(session)).find(file1).getSize());
final PathAttributes attr = cryptomator.getFeature(session, AttributesFinder.class, new DAVAttributesFinderFeature(session)).find(file1);
assertEquals(content.length, attr.getSize());
assertNull(attr.getDisplayname());
{
final ByteArrayOutputStream buffer = new ByteArrayOutputStream(content.length);
final InputStream in = new CryptoReadFeature(session, new DAVReadFeature(session), cryptomator).read(file1, new TransferStatus().setLength(content.length), ConnectionCallback.noop);
Expand All @@ -141,9 +145,9 @@ public void testDownload() throws Exception {
final Path home = new DefaultHomeFinderService(session).find();
final Path vault = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
final DefaultVaultProvider provider = new DefaultVaultProvider(session);
final AbstractVault cryptomator = provider.create(session, null, vault, new VaultVersion(vaultVersion), new VaultCredentials("test"));
session.withRegistry(new DefaultVaultRegistry(new DisabledPasswordCallback(),
provider.load(session, cryptomator.getHome(), new VaultVersion(vaultVersion), new VaultCredentials("test"))));
provider.create(session, null, vault, new VaultVersion(vaultVersion), new VaultCredentials("test"));
final AbstractVault cryptomator = provider.load(session, vault, new VaultVersion(vaultVersion), new VaultCredentials("test"));
session.withRegistry(new DefaultVaultRegistry(new DisabledPasswordCallback(), cryptomator));
final Path dir1 = cryptomator.getFeature(session, Directory.class, new DAVDirectoryFeature(session)).mkdir(
cryptomator.getFeature(session, Write.class, new DAVWriteFeature(session)), new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus());
final Local localDirectory1 = new Local(System.getProperty("java.io.tmpdir"), new AlphanumericRandomStringService().random());
Expand Down
Loading