diff --git a/core/src/main/java/ch/cyberduck/core/shared/DefaultShareFeature.java b/core/src/main/java/ch/cyberduck/core/shared/DefaultShareFeature.java index ab1dda0b5be..56281bf5e8c 100644 --- a/core/src/main/java/ch/cyberduck/core/shared/DefaultShareFeature.java +++ b/core/src/main/java/ch/cyberduck/core/shared/DefaultShareFeature.java @@ -22,6 +22,8 @@ import ch.cyberduck.core.exception.BackgroundException; import ch.cyberduck.core.features.Share; +import java.util.EnumSet; + public class DefaultShareFeature implements Share { private final UrlProvider proxy; @@ -33,14 +35,14 @@ public DefaultShareFeature(final UrlProvider proxy) { @Override public boolean isSupported(final Path file, final Type type) { if(Type.download == type) { - return !DescriptiveUrl.EMPTY.equals(proxy.toUrl(file).find(DescriptiveUrl.Type.signed)); + return !DescriptiveUrl.EMPTY.equals(proxy.toUrl(file, EnumSet.of(DescriptiveUrl.Type.signed)).find(DescriptiveUrl.Type.signed)); } return false; } @Override public DescriptiveUrl toDownloadUrl(final Path file, final Sharee sharee, final Object options, final PasswordCallback callback) { - return proxy.toUrl(file).find(DescriptiveUrl.Type.signed); + return proxy.toUrl(file, EnumSet.of(DescriptiveUrl.Type.signed)).find(DescriptiveUrl.Type.signed); } @Override diff --git a/core/src/main/java/ch/cyberduck/core/transfer/Transfer.java b/core/src/main/java/ch/cyberduck/core/transfer/Transfer.java index ce940103b32..378951709ff 100644 --- a/core/src/main/java/ch/cyberduck/core/transfer/Transfer.java +++ b/core/src/main/java/ch/cyberduck/core/transfer/Transfer.java @@ -43,6 +43,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Date; +import java.util.EnumSet; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -229,10 +230,10 @@ public TransferItem getRoot() { public DescriptiveUrl getRemote() { if(this.roots.size() == 1) { - return new DefaultUrlProvider(host).toUrl(this.getRoot().remote).find(DescriptiveUrl.Type.provider); + return new DefaultUrlProvider(host).toUrl(this.getRoot().remote, EnumSet.of(DescriptiveUrl.Type.provider)).find(DescriptiveUrl.Type.provider); } else { - return new DefaultUrlProvider(host).toUrl(this.getRoot().remote.getParent()).find(DescriptiveUrl.Type.provider); + return new DefaultUrlProvider(host).toUrl(this.getRoot().remote.getParent(), EnumSet.of(DescriptiveUrl.Type.provider)).find(DescriptiveUrl.Type.provider); } } 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 a333c8384eb..9eece598754 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 @@ -62,6 +62,7 @@ import java.nio.file.Paths; import java.text.MessageFormat; import java.util.ArrayList; +import java.util.EnumSet; import java.util.Iterator; import java.util.List; @@ -284,7 +285,8 @@ public void complete(final Path file, final Local local, icon.remove(local); } if(options.quarantine || options.wherefrom) { - final DescriptiveUrlBag provider = session.getFeature(UrlProvider.class).toUrl(file).filter(DescriptiveUrl.Type.provider, DescriptiveUrl.Type.http); + final DescriptiveUrlBag provider = session.getFeature(UrlProvider.class).toUrl(file, + EnumSet.of(DescriptiveUrl.Type.provider)).filter(DescriptiveUrl.Type.provider, DescriptiveUrl.Type.http); for(DescriptiveUrl url : provider) { try { if(options.quarantine) { diff --git a/cryptomator/src/main/java/ch/cyberduck/core/cryptomator/CryptoVault.java b/cryptomator/src/main/java/ch/cyberduck/core/cryptomator/CryptoVault.java index 60da7cff974..447f4eee655 100644 --- a/cryptomator/src/main/java/ch/cyberduck/core/cryptomator/CryptoVault.java +++ b/cryptomator/src/main/java/ch/cyberduck/core/cryptomator/CryptoVault.java @@ -142,7 +142,7 @@ public synchronized Path create(final Session session, final String region, f if(credentials.isSaved()) { try { keychain.addPassword(String.format("Cryptomator Passphrase (%s)", bookmark.getCredentials().getUsername()), - new DefaultUrlProvider(bookmark).toUrl(masterkey).find(DescriptiveUrl.Type.provider).getUrl(), credentials.getPassword()); + new DefaultUrlProvider(bookmark).toUrl(masterkey, EnumSet.of(DescriptiveUrl.Type.provider)).find(DescriptiveUrl.Type.provider).getUrl(), credentials.getPassword()); } catch(LocalAccessDeniedException e) { log.error("Failure {} saving credentials for {} in password store", e, bookmark); @@ -210,11 +210,11 @@ public synchronized CryptoVault load(final Session session, final PasswordCal } final Host bookmark = session.getHost(); String passphrase = keychain.getPassword(String.format("Cryptomator Passphrase (%s)", bookmark.getCredentials().getUsername()), - new DefaultUrlProvider(bookmark).toUrl(masterkey).find(DescriptiveUrl.Type.provider).getUrl()); + new DefaultUrlProvider(bookmark).toUrl(masterkey, EnumSet.of(DescriptiveUrl.Type.provider)).find(DescriptiveUrl.Type.provider).getUrl()); if(null == passphrase) { // Legacy passphrase = keychain.getPassword(String.format("Cryptomator Passphrase %s", bookmark.getHostname()), - new DefaultUrlProvider(bookmark).toUrl(masterkey).find(DescriptiveUrl.Type.provider).getUrl()); + new DefaultUrlProvider(bookmark).toUrl(masterkey, EnumSet.of(DescriptiveUrl.Type.provider)).find(DescriptiveUrl.Type.provider).getUrl()); } return this.unlock(session, prompt, bookmark, passphrase); } @@ -289,7 +289,7 @@ public void unlock(final VaultConfig vaultConfig, final String passphrase, final log.info("Save passphrase for {}", masterkey); // Save password with hostname and path to masterkey.cryptomator in keychain keychain.addPassword(String.format("Cryptomator Passphrase (%s)", bookmark.getCredentials().getUsername()), - new DefaultUrlProvider(bookmark).toUrl(masterkey).find(DescriptiveUrl.Type.provider).getUrl(), credentials.getPassword()); + new DefaultUrlProvider(bookmark).toUrl(masterkey, EnumSet.of(DescriptiveUrl.Type.provider)).find(DescriptiveUrl.Type.provider).getUrl(), credentials.getPassword()); } } catch(CryptoAuthenticationException e) { diff --git a/dracoon/src/main/java/ch/cyberduck/core/sds/triplecrypt/TripleCryptKeyPair.java b/dracoon/src/main/java/ch/cyberduck/core/sds/triplecrypt/TripleCryptKeyPair.java index 9df71b72ccb..3f90764d550 100644 --- a/dracoon/src/main/java/ch/cyberduck/core/sds/triplecrypt/TripleCryptKeyPair.java +++ b/dracoon/src/main/java/ch/cyberduck/core/sds/triplecrypt/TripleCryptKeyPair.java @@ -91,7 +91,8 @@ protected static String toServiceName(final Host bookmark, final UserKeyPair.Ver } protected static String toAccountName(final Host bookmark) { - return new DefaultUrlProvider(bookmark).toUrl(new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory))).find(DescriptiveUrl.Type.provider).getUrl(); + return new DefaultUrlProvider(bookmark).toUrl(new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory)), + EnumSet.of(DescriptiveUrl.Type.provider)).find(DescriptiveUrl.Type.provider).getUrl(); } public static PlainDataContainer createPlainDataContainer(final byte[] bytes, final int len) { diff --git a/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveReadFeature.java b/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveReadFeature.java index 88775a26758..fd967ce644d 100644 --- a/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveReadFeature.java +++ b/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveReadFeature.java @@ -38,6 +38,7 @@ import java.io.InputStream; import java.nio.charset.Charset; import java.text.MessageFormat; +import java.util.EnumSet; import com.google.api.client.http.HttpHeaders; import com.google.api.services.drive.Drive; @@ -58,7 +59,7 @@ public DriveReadFeature(final DriveSession session, final DriveFileIdProvider fi @Override public InputStream read(final Path file, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { if(file.isPlaceholder()) { - final DescriptiveUrl link = new DriveUrlProvider().toUrl(file).find(DescriptiveUrl.Type.http); + final DescriptiveUrl link = new DriveUrlProvider().toUrl(file, EnumSet.of(DescriptiveUrl.Type.http)).find(DescriptiveUrl.Type.http); if(DescriptiveUrl.EMPTY.equals(link)) { log.warn("Missing web link for file {}", file); return new NullInputStream(file.attributes().getSize()); diff --git a/onedrive/src/main/java/ch/cyberduck/core/onedrive/features/GraphReadFeature.java b/onedrive/src/main/java/ch/cyberduck/core/onedrive/features/GraphReadFeature.java index ea3a405b23f..38116d81386 100644 --- a/onedrive/src/main/java/ch/cyberduck/core/onedrive/features/GraphReadFeature.java +++ b/onedrive/src/main/java/ch/cyberduck/core/onedrive/features/GraphReadFeature.java @@ -29,18 +29,17 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.io.input.NullInputStream; -import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpStatus; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.nuxeo.onedrive.client.Files; import org.nuxeo.onedrive.client.OneDriveAPIException; import org.nuxeo.onedrive.client.types.DriveItem; -import org.nuxeo.onedrive.client.types.DriveItemVersion; import java.io.IOException; import java.io.InputStream; import java.nio.charset.Charset; +import java.util.EnumSet; public class GraphReadFeature implements Read { private static final Logger log = LogManager.getLogger(GraphReadFeature.class); @@ -57,7 +56,7 @@ public GraphReadFeature(final GraphSession session, final GraphFileIdProvider fi public InputStream read(final Path file, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { try { if(file.getType().contains(Path.Type.placeholder)) { - final DescriptiveUrl link = new GraphUrlProvider().toUrl(file).find(DescriptiveUrl.Type.http); + final DescriptiveUrl link = new GraphUrlProvider().toUrl(file, EnumSet.of(DescriptiveUrl.Type.http)).find(DescriptiveUrl.Type.http); if(DescriptiveUrl.EMPTY.equals(link)) { log.warn("Missing web link for file {}", file); return new NullInputStream(file.attributes().getSize()); 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 5d9d0d275cb..b5b3d9133cd 100644 --- a/tus/src/main/java/ch/cyberduck/core/tus/TusUploadFeature.java +++ b/tus/src/main/java/ch/cyberduck/core/tus/TusUploadFeature.java @@ -60,6 +60,7 @@ import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.util.ArrayList; +import java.util.EnumSet; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -109,7 +110,8 @@ public Void upload(final Path file, final Local local, final BandwidthThrottle t throw new InteroperabilityException(String.format("No support for %s", Extension.creation)); } // Create an Upload URL - final HttpPost request = new HttpPost(new DefaultUrlProvider(host).toUrl(file.getParent()).find(DescriptiveUrl.Type.provider).getUrl()); + final HttpPost request = new HttpPost(new DefaultUrlProvider(host).toUrl(file.getParent(), + EnumSet.of(DescriptiveUrl.Type.provider)).find(DescriptiveUrl.Type.provider).getUrl()); request.setHeader(TUS_HEADER_RESUMABLE, TUS_VERSION); // The Upload-Length header indicates the size of the entire upload in bytes request.setHeader(TUS_HEADER_UPLOAD_LENGTH, String.valueOf(status.getDestinationlength())); @@ -232,7 +234,8 @@ public Long handleResponse(final HttpResponse response) throws HttpResponseExcep */ private static String toUploadUrlPropertyKey(final Host host, final Path file, final TransferStatus status) { return String.format("tus.url.%s%s", - Base64.encodeBase64String(new DefaultUrlProvider(host).toUrl(file).find(DescriptiveUrl.Type.provider).getUrl().getBytes(StandardCharsets.UTF_8)), + Base64.encodeBase64String(new DefaultUrlProvider(host).toUrl(file, + EnumSet.of(DescriptiveUrl.Type.provider)).find(DescriptiveUrl.Type.provider).getUrl().getBytes(StandardCharsets.UTF_8)), null == status.getChecksum() ? StringUtils.EMPTY : String.format(":%s", status.getChecksum().base64)); } diff --git a/webdav/src/main/java/ch/cyberduck/core/dav/DAVCopyFeature.java b/webdav/src/main/java/ch/cyberduck/core/dav/DAVCopyFeature.java index cc6abdac5a5..aeac3b15ec2 100644 --- a/webdav/src/main/java/ch/cyberduck/core/dav/DAVCopyFeature.java +++ b/webdav/src/main/java/ch/cyberduck/core/dav/DAVCopyFeature.java @@ -48,7 +48,8 @@ public DAVCopyFeature(final DAVSession session) { @Override public Path copy(final Path source, final Path copy, final TransferStatus status, final ConnectionCallback callback, final StreamListener listener) throws BackgroundException { try { - final String target = new DefaultUrlProvider(session.getHost()).toUrl(copy).find(DescriptiveUrl.Type.provider).getUrl(); + final String target = new DefaultUrlProvider(session.getHost()).toUrl(copy, + EnumSet.of(DescriptiveUrl.Type.provider)).find(DescriptiveUrl.Type.provider).getUrl(); if(status.getLockId() != null && session.getFeature(Lock.class) != null) { // Indicate that the client has knowledge of that state token session.getClient().copy(new DAVPathEncoder().encode(source), target, status.isExists(), diff --git a/webdav/src/main/java/ch/cyberduck/core/dav/DAVMoveFeature.java b/webdav/src/main/java/ch/cyberduck/core/dav/DAVMoveFeature.java index 8d2ed622f1e..35da8fa8c2b 100644 --- a/webdav/src/main/java/ch/cyberduck/core/dav/DAVMoveFeature.java +++ b/webdav/src/main/java/ch/cyberduck/core/dav/DAVMoveFeature.java @@ -49,7 +49,8 @@ public DAVMoveFeature(final DAVSession session) { @Override public Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback) throws BackgroundException { try { - final String target = new DefaultUrlProvider(session.getHost()).toUrl(renamed).find(DescriptiveUrl.Type.provider).getUrl(); + final String target = new DefaultUrlProvider(session.getHost()).toUrl(renamed, + EnumSet.of(DescriptiveUrl.Type.provider)).find(DescriptiveUrl.Type.provider).getUrl(); if(status.getLockId() != null && session.getFeature(Lock.class) != null) { // Indicate that the client has knowledge of that state token session.getClient().move(new DAVPathEncoder().encode(file), file.isDirectory() ? String.format("%s/", target) : target,