From ccfaade1b3c9332aba433b86bb23538b10111f56 Mon Sep 17 00:00:00 2001 From: David Kocher Date: Wed, 5 Jul 2023 14:56:02 +0200 Subject: [PATCH] Add sharee definition. --- .../core/b2/B2AuthorizedUrlProvider.java | 8 +- .../core/b2/B2AuthorizedUrlProviderTest.java | 2 +- .../cyberduck/core/box/BoxShareFeature.java | 4 +- .../core/box/BoxShareFeatureTest.java | 4 +- .../core/brick/BrickShareFeature.java | 4 +- .../core/brick/BrickShareFeatureTest.java | 3 +- .../core/DefaulPromptUrlProvider.java | 4 +- .../core/features/PromptUrlProvider.java | 37 ++- .../core/worker/DownloadShareWorker.java | 2 +- .../core/worker/UploadShareWorker.java | 2 +- .../core/sds/SDSSharesUrlProvider.java | 4 +- .../core/sds/SDSSharesUrlProviderTest.java | 249 +++++++++--------- .../core/dropbox/DropboxShareUrlProvider.java | 4 +- .../dropbox/DropboxTemporaryUrlProvider.java | 4 +- .../DropboxPasswordShareUrlProviderTest.java | 16 +- .../DropboxTemporaryUrlProviderTest.java | 3 +- .../cyberduck/core/eue/EueShareFeature.java | 4 +- .../core/eue/EueShareFeatureTest.java | 14 +- .../googledrive/DriveSharingUrlProvider.java | 6 +- .../DriveSharingUrlProviderTest.java | 2 +- .../GoogleStoragePublicUrlProvider.java | 4 +- .../nextcloud/NextcloudShareProvider.java | 4 +- .../nextcloud/NextcloudShareProviderTest.java | 14 +- .../features/GraphPromptUrlProvider.java | 8 +- .../onedrive/GraphPromptUrlProviderTest.java | 3 +- .../core/s3/S3PublicUrlProvider.java | 4 +- .../core/s3/S3PublicUrlProviderTest.java | 2 +- .../core/storegate/StoregateShareFeature.java | 4 +- .../storegate/StoregateShareFeatureTest.java | 5 +- 29 files changed, 231 insertions(+), 193 deletions(-) diff --git a/backblaze/src/main/java/ch/cyberduck/core/b2/B2AuthorizedUrlProvider.java b/backblaze/src/main/java/ch/cyberduck/core/b2/B2AuthorizedUrlProvider.java index c5deda9584f..28547a2479e 100644 --- a/backblaze/src/main/java/ch/cyberduck/core/b2/B2AuthorizedUrlProvider.java +++ b/backblaze/src/main/java/ch/cyberduck/core/b2/B2AuthorizedUrlProvider.java @@ -62,10 +62,10 @@ public boolean isSupported(final Path file, final Type type) { } @Override - public DescriptiveUrl toDownloadUrl(final Path file, final Void none, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toDownloadUrl(final Path file, final Sharee sharee, final Void none, final PasswordCallback callback) throws BackgroundException { final String download = String.format("%s/file/%s/%s", session.getClient().getDownloadUrl(), - URIEncoder.encode(containerService.getContainer(file).getName()), - URIEncoder.encode(containerService.getKey(file))); + URIEncoder.encode(containerService.getContainer(file).getName()), + URIEncoder.encode(containerService.getKey(file))); try { if(log.isDebugEnabled()) { log.debug(String.format("Create download authorization for %s", file)); @@ -91,7 +91,7 @@ public DescriptiveUrl toDownloadUrl(final Path file, final Void none, final Pass } @Override - public DescriptiveUrl toUploadUrl(final Path file, final Void none, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toUploadUrl(final Path file, final Sharee sharee, final Void none, final PasswordCallback callback) throws BackgroundException { return DescriptiveUrl.EMPTY; } } diff --git a/backblaze/src/test/java/ch/cyberduck/core/b2/B2AuthorizedUrlProviderTest.java b/backblaze/src/test/java/ch/cyberduck/core/b2/B2AuthorizedUrlProviderTest.java index e9570dedfc6..2c453e9c280 100644 --- a/backblaze/src/test/java/ch/cyberduck/core/b2/B2AuthorizedUrlProviderTest.java +++ b/backblaze/src/test/java/ch/cyberduck/core/b2/B2AuthorizedUrlProviderTest.java @@ -44,7 +44,7 @@ public void testToUrl() throws Exception { new B2TouchFeature(session, fileid).touch(test, new TransferStatus()); final B2AuthorizedUrlProvider provider = new B2AuthorizedUrlProvider(session, fileid); assertFalse(provider.isSupported(bucket, PromptUrlProvider.Type.download)); - final DescriptiveUrl url = provider.toDownloadUrl(test, null, new DisabledPasswordCallback()); + final DescriptiveUrl url = provider.toDownloadUrl(test, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback()); assertNotEquals(DescriptiveUrl.EMPTY, url); assertNotNull(url.getUrl()); new B2DeleteFeature(session, fileid).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); diff --git a/box/src/main/java/ch/cyberduck/core/box/BoxShareFeature.java b/box/src/main/java/ch/cyberduck/core/box/BoxShareFeature.java index 22bbf4bd8bc..cfe3fcfe86d 100644 --- a/box/src/main/java/ch/cyberduck/core/box/BoxShareFeature.java +++ b/box/src/main/java/ch/cyberduck/core/box/BoxShareFeature.java @@ -60,7 +60,7 @@ public boolean isSupported(final Path file, final Type type) { } @Override - public DescriptiveUrl toDownloadUrl(final Path file, final Object options, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toDownloadUrl(final Path file, final Sharee sharee, final Object options, final PasswordCallback callback) throws BackgroundException { if(file.isDirectory()) { return this.createFolderSharedLink(file, callback); } @@ -68,7 +68,7 @@ public DescriptiveUrl toDownloadUrl(final Path file, final Object options, final } @Override - public DescriptiveUrl toUploadUrl(final Path file, final Object options, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toUploadUrl(final Path file, final Sharee sharee, final Object options, final PasswordCallback callback) throws BackgroundException { throw new UnsupportedException(); } diff --git a/box/src/test/java/ch/cyberduck/core/box/BoxShareFeatureTest.java b/box/src/test/java/ch/cyberduck/core/box/BoxShareFeatureTest.java index 8046de0815a..2986c755067 100644 --- a/box/src/test/java/ch/cyberduck/core/box/BoxShareFeatureTest.java +++ b/box/src/test/java/ch/cyberduck/core/box/BoxShareFeatureTest.java @@ -43,7 +43,7 @@ public void testFolder() throws Exception { final BoxShareFeature feature = new BoxShareFeature(session, fileid); assertTrue(feature.isSupported(directory, PromptUrlProvider.Type.download)); assertFalse(feature.isSupported(directory, PromptUrlProvider.Type.upload)); - assertNotNull(feature.toDownloadUrl(directory, null, new DisabledPasswordCallback()).getUrl()); + assertNotNull(feature.toDownloadUrl(directory, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback()).getUrl()); new BoxDeleteFeature(session, fileid).delete(Collections.singletonList(directory), new DisabledPasswordCallback(), new Delete.DisabledCallback()); } @@ -55,7 +55,7 @@ public void testFile() throws Exception { final BoxShareFeature feature = new BoxShareFeature(session, fileid); assertTrue(feature.isSupported(test, PromptUrlProvider.Type.download)); assertFalse(feature.isSupported(test, PromptUrlProvider.Type.upload)); - assertNotNull(feature.toDownloadUrl(test, null, new DisabledPasswordCallback()).getUrl()); + assertNotNull(feature.toDownloadUrl(test, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback()).getUrl()); new BoxDeleteFeature(session, fileid).delete(Collections.singletonList(test), new DisabledPasswordCallback(), new Delete.DisabledCallback()); } } \ No newline at end of file diff --git a/brick/src/main/java/ch/cyberduck/core/brick/BrickShareFeature.java b/brick/src/main/java/ch/cyberduck/core/brick/BrickShareFeature.java index a4e5a7b570d..dd92da77781 100644 --- a/brick/src/main/java/ch/cyberduck/core/brick/BrickShareFeature.java +++ b/brick/src/main/java/ch/cyberduck/core/brick/BrickShareFeature.java @@ -47,7 +47,7 @@ public boolean isSupported(final Path file, final Type type) { } @Override - public DescriptiveUrl toDownloadUrl(final Path file, final Object options, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toDownloadUrl(final Path file, final Sharee sharee, final Object options, final PasswordCallback callback) throws BackgroundException { try { final Credentials password = callback.prompt(session.getHost(), LocaleFactory.localizedString("Passphrase", "Cryptomator"), @@ -63,7 +63,7 @@ public DescriptiveUrl toDownloadUrl(final Path file, final Object options, final } @Override - public DescriptiveUrl toUploadUrl(final Path file, final Object options, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toUploadUrl(final Path file, final Sharee sharee, final Object options, final PasswordCallback callback) throws BackgroundException { return DescriptiveUrl.EMPTY; } } diff --git a/brick/src/test/java/ch/cyberduck/core/brick/BrickShareFeatureTest.java b/brick/src/test/java/ch/cyberduck/core/brick/BrickShareFeatureTest.java index bb36f2bb819..55c24ba8275 100644 --- a/brick/src/test/java/ch/cyberduck/core/brick/BrickShareFeatureTest.java +++ b/brick/src/test/java/ch/cyberduck/core/brick/BrickShareFeatureTest.java @@ -19,6 +19,7 @@ import ch.cyberduck.core.DisabledPasswordCallback; import ch.cyberduck.core.Path; import ch.cyberduck.core.features.Delete; +import ch.cyberduck.core.features.PromptUrlProvider; import ch.cyberduck.core.transfer.TransferStatus; import ch.cyberduck.test.IntegrationTest; @@ -39,7 +40,7 @@ public void toDownloadUrl() throws Exception { EnumSet.of(Path.Type.directory, Path.Type.volume)), new TransferStatus()); final Path test = new BrickTouchFeature(session).touch( new Path(directory, String.format("%s", new AlphanumericRandomStringService().random()), EnumSet.of(Path.Type.file)), new TransferStatus()); - assertNotNull(new BrickShareFeature(session).toDownloadUrl(test, null, new DisabledPasswordCallback()).getUrl()); + assertNotNull(new BrickShareFeature(session).toDownloadUrl(test, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback()).getUrl()); new BrickDeleteFeature(session).delete(Collections.singletonList(directory), new DisabledPasswordCallback(), new Delete.DisabledCallback()); } } diff --git a/core/src/main/java/ch/cyberduck/core/DefaulPromptUrlProvider.java b/core/src/main/java/ch/cyberduck/core/DefaulPromptUrlProvider.java index 408bab03a1e..00a3eb9524b 100644 --- a/core/src/main/java/ch/cyberduck/core/DefaulPromptUrlProvider.java +++ b/core/src/main/java/ch/cyberduck/core/DefaulPromptUrlProvider.java @@ -35,12 +35,12 @@ public boolean isSupported(final Path file, final Type type) { } @Override - public DescriptiveUrl toDownloadUrl(final Path file, final Object options, final PasswordCallback callback) { + public DescriptiveUrl toDownloadUrl(final Path file, final Sharee sharee, final Object options, final PasswordCallback callback) { return proxy.toUrl(file).find(DescriptiveUrl.Type.signed); } @Override - public DescriptiveUrl toUploadUrl(final Path file, final Object options, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toUploadUrl(final Path file, final Sharee sharee, final Object options, final PasswordCallback callback) throws BackgroundException { return DescriptiveUrl.EMPTY; } } diff --git a/core/src/main/java/ch/cyberduck/core/features/PromptUrlProvider.java b/core/src/main/java/ch/cyberduck/core/features/PromptUrlProvider.java index 047c3a3a999..139272e3810 100644 --- a/core/src/main/java/ch/cyberduck/core/features/PromptUrlProvider.java +++ b/core/src/main/java/ch/cyberduck/core/features/PromptUrlProvider.java @@ -16,20 +16,53 @@ */ import ch.cyberduck.core.DescriptiveUrl; +import ch.cyberduck.core.LocaleFactory; import ch.cyberduck.core.PasswordCallback; import ch.cyberduck.core.Path; import ch.cyberduck.core.exception.BackgroundException; +import java.util.Collections; +import java.util.List; + @Optional public interface PromptUrlProvider { boolean isSupported(Path file, Type type); - DescriptiveUrl toDownloadUrl(Path file, Download options, PasswordCallback callback) throws BackgroundException; + /** + * Retrieve list of users from server + * + * @return List of possible users to select from + */ + default List getSharees() throws BackgroundException { + return Collections.singletonList(Sharee.world); + } + + DescriptiveUrl toDownloadUrl(Path file, Sharee sharee, Download options, PasswordCallback callback) throws BackgroundException; - DescriptiveUrl toUploadUrl(Path file, Upload options, PasswordCallback callback) throws BackgroundException; + DescriptiveUrl toUploadUrl(Path file, Sharee sharee, Upload options, PasswordCallback callback) throws BackgroundException; enum Type { download, upload } + + class Sharee { + private final String identifier; + private final String description; + + public Sharee(final String identifier, final String description) { + this.identifier = identifier; + this.description = description; + } + + public String getIdentifier() { + return identifier; + } + + public String getDescription() { + return description; + } + + public static final Sharee world = new Sharee(null, LocaleFactory.localizedString("Public")); + } } diff --git a/core/src/main/java/ch/cyberduck/core/worker/DownloadShareWorker.java b/core/src/main/java/ch/cyberduck/core/worker/DownloadShareWorker.java index 41626f2d96b..5e3f2949d35 100644 --- a/core/src/main/java/ch/cyberduck/core/worker/DownloadShareWorker.java +++ b/core/src/main/java/ch/cyberduck/core/worker/DownloadShareWorker.java @@ -48,7 +48,7 @@ public DescriptiveUrl run(final Session session) throws BackgroundException { if(log.isDebugEnabled()) { log.debug(String.format("Run with feature %s", provider)); } - return provider.toDownloadUrl(file, options, callback); + return provider.toDownloadUrl(file, PromptUrlProvider.Sharee.world, options, callback); } @Override diff --git a/core/src/main/java/ch/cyberduck/core/worker/UploadShareWorker.java b/core/src/main/java/ch/cyberduck/core/worker/UploadShareWorker.java index b7f5e09c968..633a4ba8de7 100644 --- a/core/src/main/java/ch/cyberduck/core/worker/UploadShareWorker.java +++ b/core/src/main/java/ch/cyberduck/core/worker/UploadShareWorker.java @@ -48,7 +48,7 @@ public DescriptiveUrl run(final Session session) throws BackgroundException { if(log.isDebugEnabled()) { log.debug(String.format("Run with feature %s", provider)); } - return provider.toUploadUrl(file, options, callback); + return provider.toUploadUrl(file, PromptUrlProvider.Sharee.world, options, callback); } @Override diff --git a/dracoon/src/main/java/ch/cyberduck/core/sds/SDSSharesUrlProvider.java b/dracoon/src/main/java/ch/cyberduck/core/sds/SDSSharesUrlProvider.java index 3550e40a9b1..a11288952ae 100644 --- a/dracoon/src/main/java/ch/cyberduck/core/sds/SDSSharesUrlProvider.java +++ b/dracoon/src/main/java/ch/cyberduck/core/sds/SDSSharesUrlProvider.java @@ -105,7 +105,7 @@ public boolean isSupported(final Path file, final Type type) { } @Override - public DescriptiveUrl toDownloadUrl(final Path file, CreateDownloadShareRequest options, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toDownloadUrl(final Path file, final Sharee sharee, CreateDownloadShareRequest options, final PasswordCallback callback) throws BackgroundException { try { if(log.isDebugEnabled()) { log.debug(String.format("Create download share for %s", file)); @@ -178,7 +178,7 @@ public DescriptiveUrl toDownloadUrl(final Path file, CreateDownloadShareRequest } @Override - public DescriptiveUrl toUploadUrl(final Path file, CreateUploadShareRequest options, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toUploadUrl(final Path file, final Sharee sharee, CreateUploadShareRequest options, final PasswordCallback callback) throws BackgroundException { try { if(log.isDebugEnabled()) { log.debug(String.format("Create upload share for %s", file)); diff --git a/dracoon/src/test/java/ch/cyberduck/core/sds/SDSSharesUrlProviderTest.java b/dracoon/src/test/java/ch/cyberduck/core/sds/SDSSharesUrlProviderTest.java index 2e32fa51070..4501b8894d5 100644 --- a/dracoon/src/test/java/ch/cyberduck/core/sds/SDSSharesUrlProviderTest.java +++ b/dracoon/src/test/java/ch/cyberduck/core/sds/SDSSharesUrlProviderTest.java @@ -26,6 +26,7 @@ import ch.cyberduck.core.exception.InteroperabilityException; import ch.cyberduck.core.exception.LoginCanceledException; import ch.cyberduck.core.features.Delete; +import ch.cyberduck.core.features.PromptUrlProvider; import ch.cyberduck.core.sds.io.swagger.client.model.CreateDownloadShareRequest; import ch.cyberduck.core.sds.io.swagger.client.model.CreateUploadShareRequest; import ch.cyberduck.core.sds.io.swagger.client.model.ObjectExpiration; @@ -51,16 +52,16 @@ public void testShareFile() throws Exception { final Path room = new SDSDirectoryFeature(session, nodeid).mkdir(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), new TransferStatus()); final Path test = new SDSTouchFeature(session, nodeid).touch(new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus()); final DescriptiveUrl url = new SDSSharesUrlProvider(session, nodeid).toDownloadUrl(test, - new CreateDownloadShareRequest() - .expiration(new ObjectExpiration().enableExpiration(false)) - .notifyCreator(false) - .sendMail(false) - .sendSms(false) - .password(null) - .mailRecipients(null) - .mailSubject(null) - .mailBody(null) - .maxDownloads(null), new DisabledPasswordCallback()); + PromptUrlProvider.Sharee.world, new CreateDownloadShareRequest() + .expiration(new ObjectExpiration().enableExpiration(false)) + .notifyCreator(false) + .sendMail(false) + .sendSms(false) + .password(null) + .mailRecipients(null) + .mailSubject(null) + .mailBody(null) + .maxDownloads(null), new DisabledPasswordCallback()); assertNotEquals(DescriptiveUrl.EMPTY, url); assertEquals(DescriptiveUrl.Type.signed, url.getType()); assertTrue(url.getUrl().startsWith("https://duck.dracoon.com/public/download-shares/")); @@ -72,16 +73,16 @@ public void testShareTopLevelRoom() throws Exception { final SDSNodeIdProvider nodeid = new SDSNodeIdProvider(session); final Path room = new SDSDirectoryFeature(session, nodeid).mkdir(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), new TransferStatus()); final DescriptiveUrl url = new SDSSharesUrlProvider(session, nodeid).toDownloadUrl(room, - new CreateDownloadShareRequest() - .expiration(new ObjectExpiration().enableExpiration(false)) - .notifyCreator(false) - .sendMail(false) - .sendSms(false) - .password(null) - .mailRecipients(null) - .mailSubject(null) - .mailBody(null) - .maxDownloads(null), new DisabledPasswordCallback()); + PromptUrlProvider.Sharee.world, new CreateDownloadShareRequest() + .expiration(new ObjectExpiration().enableExpiration(false)) + .notifyCreator(false) + .sendMail(false) + .sendSms(false) + .password(null) + .mailRecipients(null) + .mailSubject(null) + .mailBody(null) + .maxDownloads(null), new DisabledPasswordCallback()); assertNotEquals(DescriptiveUrl.EMPTY, url); assertEquals(DescriptiveUrl.Type.signed, url.getType()); assertTrue(url.getUrl().startsWith("https://duck.dracoon.com/public/download-shares/")); @@ -94,16 +95,16 @@ public void testShareSubRoom() throws Exception { final Path room = new SDSDirectoryFeature(session, nodeid).mkdir(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), new TransferStatus()); final Path test = new SDSDirectoryFeature(session, nodeid).mkdir(new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus()); final DescriptiveUrl url = new SDSSharesUrlProvider(session, nodeid).toDownloadUrl(test, - new CreateDownloadShareRequest() - .expiration(new ObjectExpiration().enableExpiration(false)) - .notifyCreator(false) - .sendMail(false) - .sendSms(false) - .password(null) - .mailRecipients(null) - .mailSubject(null) - .mailBody(null) - .maxDownloads(null), new DisabledPasswordCallback()); + PromptUrlProvider.Sharee.world, new CreateDownloadShareRequest() + .expiration(new ObjectExpiration().enableExpiration(false)) + .notifyCreator(false) + .sendMail(false) + .sendSms(false) + .password(null) + .mailRecipients(null) + .mailSubject(null) + .mailBody(null) + .maxDownloads(null), new DisabledPasswordCallback()); assertNotEquals(DescriptiveUrl.EMPTY, url); assertEquals(DescriptiveUrl.Type.signed, url.getType()); assertTrue(url.getUrl().startsWith("https://duck.dracoon.com/public/download-shares/")); @@ -117,16 +118,16 @@ public void testToUrlMissingEmailRecipients() throws Exception { final Path test = new SDSTouchFeature(session, nodeid).touch(new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus()); try { final DescriptiveUrl url = new SDSSharesUrlProvider(session, nodeid).toDownloadUrl(test, - new CreateDownloadShareRequest() - .expiration(new ObjectExpiration().enableExpiration(false)) - .notifyCreator(false) - .sendMail(true) - .mailRecipients(null) - .sendSms(false) - .password(null) - .mailSubject(null) - .mailBody(null) - .maxDownloads(null), new DisabledPasswordCallback()); + PromptUrlProvider.Sharee.world, new CreateDownloadShareRequest() + .expiration(new ObjectExpiration().enableExpiration(false)) + .notifyCreator(false) + .sendMail(true) + .mailRecipients(null) + .sendSms(false) + .password(null) + .mailSubject(null) + .mailBody(null) + .maxDownloads(null), new DisabledPasswordCallback()); } finally { new SDSDeleteFeature(session, nodeid).delete(Collections.singletonList(room), new DisabledLoginCallback(), new Delete.DisabledCallback()); @@ -140,17 +141,17 @@ public void testToUrlInvalidSMSRecipients() throws Exception { final Path test = new SDSTouchFeature(session, nodeid).touch(new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus()); try { final DescriptiveUrl url = new SDSSharesUrlProvider(session, nodeid).toDownloadUrl(test, - new CreateDownloadShareRequest() - .expiration(new ObjectExpiration().enableExpiration(false)) - .notifyCreator(false) - .sendMail(false) - .mailRecipients(null) - .sendSms(true) - .smsRecipients("invalid") - .password("p") - .mailSubject(null) - .mailBody(null) - .maxDownloads(null), new DisabledPasswordCallback()); + PromptUrlProvider.Sharee.world, new CreateDownloadShareRequest() + .expiration(new ObjectExpiration().enableExpiration(false)) + .notifyCreator(false) + .sendMail(false) + .mailRecipients(null) + .sendSms(true) + .smsRecipients("invalid") + .password("p") + .mailSubject(null) + .mailBody(null) + .maxDownloads(null), new DisabledPasswordCallback()); } finally { new SDSDeleteFeature(session, nodeid).delete(Collections.singletonList(room), new DisabledLoginCallback(), new Delete.DisabledCallback()); @@ -164,16 +165,16 @@ public void testToUrlWeakPassword() throws Exception { final Path test = new SDSTouchFeature(session, nodeid).touch(new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus()); try { final DescriptiveUrl url = new SDSSharesUrlProvider(session, nodeid).toDownloadUrl(test, - new CreateDownloadShareRequest() - .expiration(new ObjectExpiration().enableExpiration(false)) - .notifyCreator(false) - .sendMail(false) - .mailRecipients(null) - .sendSms(false) - .password("p") - .mailSubject(null) - .mailBody(null) - .maxDownloads(null), new DisabledPasswordCallback()); + PromptUrlProvider.Sharee.world, new CreateDownloadShareRequest() + .expiration(new ObjectExpiration().enableExpiration(false)) + .notifyCreator(false) + .sendMail(false) + .mailRecipients(null) + .sendSms(false) + .password("p") + .mailSubject(null) + .mailBody(null) + .maxDownloads(null), new DisabledPasswordCallback()); } finally { new SDSDeleteFeature(session, nodeid).delete(Collections.singletonList(room), new DisabledLoginCallback(), new Delete.DisabledCallback()); @@ -187,15 +188,15 @@ public void testToUrlInvalidEmail() throws Exception { final Path test = new SDSTouchFeature(session, nodeid).touch(new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus()); try { final DescriptiveUrl url = new SDSSharesUrlProvider(session, nodeid).toDownloadUrl(test, - new CreateDownloadShareRequest() - .expiration(new ObjectExpiration().enableExpiration(false)) - .notifyCreator(false) - .sendMail(true) - .mailRecipients("a@b") - .sendSms(false) - .mailSubject(null) - .mailBody(null) - .maxDownloads(null), new DisabledPasswordCallback()); + PromptUrlProvider.Sharee.world, new CreateDownloadShareRequest() + .expiration(new ObjectExpiration().enableExpiration(false)) + .notifyCreator(false) + .sendMail(true) + .mailRecipients("a@b") + .sendSms(false) + .mailSubject(null) + .mailBody(null) + .maxDownloads(null), new DisabledPasswordCallback()); } finally { new SDSDeleteFeature(session, nodeid).delete(Collections.singletonList(room), new DisabledLoginCallback(), new Delete.DisabledCallback()); @@ -208,16 +209,16 @@ public void testToUrlExpiry() throws Exception { final Path room = new SDSDirectoryFeature(session, nodeid).mkdir(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), new TransferStatus()); final Path test = new SDSTouchFeature(session, nodeid).touch(new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus()); final DescriptiveUrl url = new SDSSharesUrlProvider(session, nodeid).toDownloadUrl(test, - new CreateDownloadShareRequest() - .expiration(new ObjectExpiration().enableExpiration(true).expireAt(new DateTime(1744300800000L))) - .notifyCreator(false) - .sendMail(false) - .sendSms(false) - .password(null) - .mailRecipients(null) - .mailSubject(null) - .mailBody(null) - .maxDownloads(null), new DisabledPasswordCallback()); + PromptUrlProvider.Sharee.world, new CreateDownloadShareRequest() + .expiration(new ObjectExpiration().enableExpiration(true).expireAt(new DateTime(1744300800000L))) + .notifyCreator(false) + .sendMail(false) + .sendSms(false) + .password(null) + .mailRecipients(null) + .mailSubject(null) + .mailBody(null) + .maxDownloads(null), new DisabledPasswordCallback()); assertNotEquals(DescriptiveUrl.EMPTY, url); assertEquals(DescriptiveUrl.Type.signed, url.getType()); assertTrue(url.getUrl().startsWith("https://duck.dracoon.com/public/download-shares/")); @@ -230,16 +231,16 @@ public void testToUrlExpiryInvalidDate() throws Exception { final Path room = new SDSDirectoryFeature(session, nodeid).mkdir(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), new TransferStatus()); final Path test = new SDSTouchFeature(session, nodeid).touch(new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus()); final DescriptiveUrl url = new SDSSharesUrlProvider(session, nodeid).toDownloadUrl(test, - new CreateDownloadShareRequest() - .expiration(new ObjectExpiration().enableExpiration(true).expireAt(new DateTime(17443L))) - .notifyCreator(false) - .sendMail(false) - .sendSms(false) - .password(null) - .mailRecipients(null) - .mailSubject(null) - .mailBody(null) - .maxDownloads(null), new DisabledPasswordCallback()); + PromptUrlProvider.Sharee.world, new CreateDownloadShareRequest() + .expiration(new ObjectExpiration().enableExpiration(true).expireAt(new DateTime(17443L))) + .notifyCreator(false) + .sendMail(false) + .sendSms(false) + .password(null) + .mailRecipients(null) + .mailSubject(null) + .mailBody(null) + .maxDownloads(null), new DisabledPasswordCallback()); assertNotEquals(DescriptiveUrl.EMPTY, url); assertEquals(DescriptiveUrl.Type.signed, url.getType()); assertTrue(url.getUrl().startsWith("https://duck.dracoon.com/public/download-shares/")); @@ -253,7 +254,7 @@ public void testEncrypted() throws Exception { new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), true); final Path test = new SDSTouchFeature(session, nodeid).touch(new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus()); final DescriptiveUrl url = new SDSSharesUrlProvider(session, nodeid).toDownloadUrl(test, - new CreateDownloadShareRequest() + PromptUrlProvider.Sharee.world, new CreateDownloadShareRequest() .expiration(new ObjectExpiration().enableExpiration(false)) .notifyCreator(false) .sendMail(false) @@ -261,9 +262,9 @@ public void testEncrypted() throws Exception { .password(null) .mailRecipients(null) .mailSubject(null) - .mailBody(null) - .maxDownloads(null), new DisabledPasswordCallback() { - @Override + .mailBody(null) + .maxDownloads(null), new DisabledPasswordCallback() { + @Override public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) { return new VaultCredentials("eth[oh8uv4Eesij"); } @@ -282,16 +283,16 @@ public void testEncryptedMissingPassword() throws Exception { final Path test = new SDSTouchFeature(session, nodeid).touch(new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus()); try { final DescriptiveUrl url = new SDSSharesUrlProvider(session, nodeid).toDownloadUrl(test, - new CreateDownloadShareRequest() + PromptUrlProvider.Sharee.world, new CreateDownloadShareRequest() .expiration(new ObjectExpiration().enableExpiration(false)) .notifyCreator(false) .sendMail(false) .sendSms(false) .password(null) .mailRecipients(null) - .mailSubject(null) - .mailBody(null) - .maxDownloads(null), new DisabledPasswordCallback()); + .mailSubject(null) + .mailBody(null) + .maxDownloads(null), new DisabledPasswordCallback()); } finally { new SDSDeleteFeature(session, nodeid).delete(Collections.singletonList(room), new DisabledLoginCallback(), new Delete.DisabledCallback()); @@ -303,17 +304,17 @@ public void testUploadAccountTopLevelRoom() throws Exception { final SDSNodeIdProvider nodeid = new SDSNodeIdProvider(session); final Path room = new SDSDirectoryFeature(session, nodeid).mkdir(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), new TransferStatus()); final DescriptiveUrl url = new SDSSharesUrlProvider(session, nodeid).toUploadUrl(room, - new CreateUploadShareRequest() - .name(new AlphanumericRandomStringService().random()) - .expiration(new ObjectExpiration().enableExpiration(false)) - .notifyCreator(false) - .sendMail(false) - .sendSms(false) - .password(null) - .mailRecipients(null) - .mailSubject(null) - .mailBody(null) - .maxSize(null) + PromptUrlProvider.Sharee.world, new CreateUploadShareRequest() + .name(new AlphanumericRandomStringService().random()) + .expiration(new ObjectExpiration().enableExpiration(false)) + .notifyCreator(false) + .sendMail(false) + .sendSms(false) + .password(null) + .mailRecipients(null) + .mailSubject(null) + .mailBody(null) + .maxSize(null) .maxSlots(null) .notes(null) .filesExpiryPeriod(null), new DisabledPasswordCallback()); @@ -330,7 +331,7 @@ public void testUploadAccountEncrypted() throws Exception { new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), true); final Path folder = new SDSDirectoryFeature(session, nodeid).mkdir(new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus()); final DescriptiveUrl url = new SDSSharesUrlProvider(session, nodeid).toUploadUrl(folder, - new CreateUploadShareRequest() + PromptUrlProvider.Sharee.world, new CreateUploadShareRequest() .name(new AlphanumericRandomStringService().random()) .expiration(new ObjectExpiration().enableExpiration(false)) .notifyCreator(false) @@ -338,9 +339,9 @@ public void testUploadAccountEncrypted() throws Exception { .sendSms(false) .password(null) .mailRecipients(null) - .mailSubject(null) - .mailBody(null) - .maxSize(null) + .mailSubject(null) + .mailBody(null) + .maxSize(null) .maxSlots(null) .notes(null) .filesExpiryPeriod(null), new DisabledPasswordCallback()); @@ -356,17 +357,17 @@ public void testUploadAccountSubRoom() throws Exception { final Path room = new SDSDirectoryFeature(session, nodeid).mkdir(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), new TransferStatus()); final Path test = new SDSDirectoryFeature(session, nodeid).mkdir(new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus()); final DescriptiveUrl url = new SDSSharesUrlProvider(session, nodeid).toUploadUrl(test, - new CreateUploadShareRequest() - .name(new AlphanumericRandomStringService().random()) - .expiration(new ObjectExpiration().enableExpiration(false)) - .notifyCreator(false) - .sendMail(false) - .sendSms(false) - .password(null) - .mailRecipients(null) - .mailSubject(null) - .mailBody(null) - .maxSize(null) + PromptUrlProvider.Sharee.world, new CreateUploadShareRequest() + .name(new AlphanumericRandomStringService().random()) + .expiration(new ObjectExpiration().enableExpiration(false)) + .notifyCreator(false) + .sendMail(false) + .sendSms(false) + .password(null) + .mailRecipients(null) + .mailSubject(null) + .mailBody(null) + .maxSize(null) .maxSlots(null) .notes(null) .filesExpiryPeriod(null), new DisabledPasswordCallback()); diff --git a/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxShareUrlProvider.java b/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxShareUrlProvider.java index 353715ed8de..862827a1206 100644 --- a/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxShareUrlProvider.java +++ b/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxShareUrlProvider.java @@ -58,7 +58,7 @@ protected SharedLinkSettings.Builder toSettings(final Path file, final PasswordC } @Override - public DescriptiveUrl toDownloadUrl(final Path file, final Void options, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toDownloadUrl(final Path file, final Sharee sharee, final Void options, final PasswordCallback callback) throws BackgroundException { final SharedLinkSettings settings = this.toSettings(file, callback).build(); try { try { @@ -102,7 +102,7 @@ public DescriptiveUrl toDownloadUrl(final Path file, final Void options, final P } @Override - public DescriptiveUrl toUploadUrl(final Path file, final Void options, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toUploadUrl(final Path file, final Sharee sharee, final Void options, final PasswordCallback callback) throws BackgroundException { try { final FileRequest request = new DbxUserFileRequestsRequests(session.getClient()) .create(file.getName(), file.isRoot() ? file.getAbsolute() : containerService.getKey(file)); diff --git a/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxTemporaryUrlProvider.java b/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxTemporaryUrlProvider.java index 579739a159b..478f82c596a 100644 --- a/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxTemporaryUrlProvider.java +++ b/dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxTemporaryUrlProvider.java @@ -48,7 +48,7 @@ public DropboxTemporaryUrlProvider(final DropboxSession session) { } @Override - public DescriptiveUrl toDownloadUrl(final Path file, final Void options, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toDownloadUrl(final Path file, final Sharee sharee, final Void options, final PasswordCallback callback) throws BackgroundException { try { if(log.isDebugEnabled()) { log.debug(String.format("Create temporary link for %s", file)); @@ -70,7 +70,7 @@ public DescriptiveUrl toDownloadUrl(final Path file, final Void options, final P } @Override - public DescriptiveUrl toUploadUrl(final Path file, final Void options, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toUploadUrl(final Path file, final Sharee sharee, final Void options, final PasswordCallback callback) throws BackgroundException { try { if(log.isDebugEnabled()) { log.debug(String.format("Create temporary upload link for %s", file)); diff --git a/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxPasswordShareUrlProviderTest.java b/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxPasswordShareUrlProviderTest.java index 208a4f236df..a3c3806e9f1 100644 --- a/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxPasswordShareUrlProviderTest.java +++ b/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxPasswordShareUrlProviderTest.java @@ -49,14 +49,14 @@ public void testSharePasswordProtected() throws Exception { final Path file = new DropboxTouchFeature(session).touch( new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus()); final DropboxPasswordShareUrlProvider provider = new DropboxPasswordShareUrlProvider(session); - final DescriptiveUrl url = provider.toDownloadUrl(file, null, new DisabledPasswordCallback() { + final DescriptiveUrl url = provider.toDownloadUrl(file, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback() { @Override public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) { return new Credentials().withPassword(new AlphanumericRandomStringService().random()); } }); assertNotEquals(DescriptiveUrl.EMPTY, url); - assertEquals(url, provider.toDownloadUrl(file, null, new DisabledPasswordCallback() { + assertEquals(url, provider.toDownloadUrl(file, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback() { @Override public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) { return new Credentials().withPassword(new AlphanumericRandomStringService().random()); @@ -70,14 +70,14 @@ public void testShareFileDownloadPublic() throws Exception { final Path file = new DropboxTouchFeature(session).touch( new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus()); final DropboxPasswordShareUrlProvider provider = new DropboxPasswordShareUrlProvider(session); - final DescriptiveUrl url = provider.toDownloadUrl(file, null, new DisabledPasswordCallback() { + final DescriptiveUrl url = provider.toDownloadUrl(file, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback() { @Override public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) throws LoginCanceledException { return bookmark.getCredentials(); } }); assertNotEquals(DescriptiveUrl.EMPTY, url); - assertEquals(url, provider.toDownloadUrl(file, null, new DisabledPasswordCallback() { + assertEquals(url, provider.toDownloadUrl(file, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback() { @Override public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) throws LoginCanceledException { return bookmark.getCredentials(); @@ -91,7 +91,7 @@ public void testShareFileDownloadPassword() throws Exception { final Path file = new DropboxTouchFeature(session).touch( new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus()); final DropboxPasswordShareUrlProvider provider = new DropboxPasswordShareUrlProvider(session); - assertThrows(InteroperabilityException.class, () -> provider.toDownloadUrl(file, null, new DisabledPasswordCallback() { + assertThrows(InteroperabilityException.class, () -> provider.toDownloadUrl(file, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback() { @Override public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) throws LoginCanceledException { return new Credentials().withPassword(new AlphanumericRandomStringService().random()); @@ -105,14 +105,14 @@ public void testShareDownloadFolderPublic() throws Exception { final Path folder = new DropboxDirectoryFeature(session).mkdir( new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus()); final DropboxPasswordShareUrlProvider provider = new DropboxPasswordShareUrlProvider(session); - final DescriptiveUrl url = provider.toDownloadUrl(folder, null, new DisabledPasswordCallback() { + final DescriptiveUrl url = provider.toDownloadUrl(folder, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback() { @Override public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) throws LoginCanceledException { return bookmark.getCredentials(); } }); assertNotEquals(DescriptiveUrl.EMPTY, url); - assertEquals(url, provider.toDownloadUrl(folder, null, new DisabledPasswordCallback() { + assertEquals(url, provider.toDownloadUrl(folder, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback() { @Override public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) throws LoginCanceledException { return bookmark.getCredentials(); @@ -128,7 +128,7 @@ public void testRequestFiles() throws Exception { final Path folder = new DropboxDirectoryFeature(session).mkdir( new Path(root, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus()); final DropboxPasswordShareUrlProvider provider = new DropboxPasswordShareUrlProvider(session); - assertNotEquals(DescriptiveUrl.EMPTY, provider.toUploadUrl(folder, null, new DisabledPasswordCallback() { + assertNotEquals(DescriptiveUrl.EMPTY, provider.toUploadUrl(folder, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback() { @Override public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) throws LoginCanceledException { return bookmark.getCredentials(); diff --git a/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxTemporaryUrlProviderTest.java b/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxTemporaryUrlProviderTest.java index 824cba684a5..22e8b2bdc09 100644 --- a/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxTemporaryUrlProviderTest.java +++ b/dropbox/src/test/java/ch/cyberduck/core/dropbox/DropboxTemporaryUrlProviderTest.java @@ -21,6 +21,7 @@ import ch.cyberduck.core.DisabledPasswordCallback; import ch.cyberduck.core.Path; import ch.cyberduck.core.features.Delete; +import ch.cyberduck.core.features.PromptUrlProvider; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; import ch.cyberduck.test.IntegrationTest; @@ -41,7 +42,7 @@ public void testToUrl() throws Exception { final DropboxTemporaryUrlProvider provider = new DropboxTemporaryUrlProvider(session); final Path file = new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); new DropboxTouchFeature(session).touch(file, new TransferStatus()); - assertNotNull(provider.toDownloadUrl(file, null, new DisabledPasswordCallback()).getUrl()); + assertNotNull(provider.toDownloadUrl(file, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback()).getUrl()); new DropboxDeleteFeature(session).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback()); } } diff --git a/eue/src/main/java/ch/cyberduck/core/eue/EueShareFeature.java b/eue/src/main/java/ch/cyberduck/core/eue/EueShareFeature.java index 36110079650..bfa36a7dceb 100644 --- a/eue/src/main/java/ch/cyberduck/core/eue/EueShareFeature.java +++ b/eue/src/main/java/ch/cyberduck/core/eue/EueShareFeature.java @@ -72,12 +72,12 @@ public boolean isSupported(final Path file, final Type type) { } @Override - public DescriptiveUrl toDownloadUrl(final Path file, final ShareCreationRequestModel options, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toDownloadUrl(final Path file, final Sharee sharee, final ShareCreationRequestModel options, final PasswordCallback callback) throws BackgroundException { return this.toGuestUrl(file, options, callback); } @Override - public DescriptiveUrl toUploadUrl(final Path file, final ShareCreationRequestModel options, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toUploadUrl(final Path file, final Sharee sharee, final ShareCreationRequestModel options, final PasswordCallback callback) throws BackgroundException { // Look for existing share return this.toGuestUrl(file, options, callback); } diff --git a/eue/src/test/java/ch/cyberduck/core/eue/EueShareFeatureTest.java b/eue/src/test/java/ch/cyberduck/core/eue/EueShareFeatureTest.java index b28463f2c12..1aa6e3a6acd 100644 --- a/eue/src/test/java/ch/cyberduck/core/eue/EueShareFeatureTest.java +++ b/eue/src/test/java/ch/cyberduck/core/eue/EueShareFeatureTest.java @@ -46,7 +46,7 @@ public void testInvalidPin() throws Exception { final Path sourceFolder = new EueDirectoryFeature(session, fileid).mkdir(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus()); final EueShareFeature feature = new EueShareFeature(session, fileid); try { - feature.toDownloadUrl(sourceFolder, null, new DisabledPasswordCallback() { + feature.toDownloadUrl(sourceFolder, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback() { @Override public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) { return new Credentials(null, "test"); @@ -67,7 +67,7 @@ public void testDownloadUrlForContainer() throws Exception { final EueResourceIdProvider fileid = new EueResourceIdProvider(session); final Path sourceFolder = new EueDirectoryFeature(session, fileid).mkdir(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus()); final EueShareFeature feature = new EueShareFeature(session, fileid); - final DescriptiveUrl url = feature.toDownloadUrl(sourceFolder, null, new DisabledPasswordCallback() { + final DescriptiveUrl url = feature.toDownloadUrl(sourceFolder, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback() { @Override public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) { return new Credentials(null, new AlphanumericRandomStringService().random()); @@ -75,7 +75,7 @@ public Credentials prompt(final Host bookmark, final String title, final String }); assertNotEquals(DescriptiveUrl.EMPTY, url); // Test returning same share - assertEquals(url, feature.toDownloadUrl(sourceFolder, null, new DisabledPasswordCallback() { + assertEquals(url, feature.toDownloadUrl(sourceFolder, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback() { @Override public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) { return new Credentials(null, new AlphanumericRandomStringService().random()); @@ -93,7 +93,7 @@ public void testDownloadUrlForFile() throws Exception { createFile(fileid, file, RandomUtils.nextBytes(0)); assertTrue(new EueFindFeature(session, fileid).find(file)); final EueShareFeature feature = new EueShareFeature(session, fileid); - final DescriptiveUrl url = feature.toDownloadUrl(file, null, new DisabledPasswordCallback() { + final DescriptiveUrl url = feature.toDownloadUrl(file, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback() { @Override public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) { return new Credentials(null, new AlphanumericRandomStringService().random()); @@ -101,7 +101,7 @@ public Credentials prompt(final Host bookmark, final String title, final String }); assertNotEquals(DescriptiveUrl.EMPTY, url); // Test returning same share - assertEquals(url, feature.toDownloadUrl(file, null, new DisabledPasswordCallback() { + assertEquals(url, feature.toDownloadUrl(file, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback() { @Override public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) { return new Credentials(null, new AlphanumericRandomStringService().random()); @@ -116,7 +116,7 @@ public void testUploadUrlForContainer() throws Exception { final EueResourceIdProvider fileid = new EueResourceIdProvider(session); final Path sourceFolder = new EueDirectoryFeature(session, fileid).mkdir(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus()); final EueShareFeature feature = new EueShareFeature(session, fileid); - final DescriptiveUrl url = feature.toUploadUrl(sourceFolder, null, new DisabledPasswordCallback() { + final DescriptiveUrl url = feature.toUploadUrl(sourceFolder, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback() { @Override public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) { return new Credentials(null, new AlphanumericRandomStringService().random()); @@ -124,7 +124,7 @@ public Credentials prompt(final Host bookmark, final String title, final String }); assertNotEquals(DescriptiveUrl.EMPTY, url); // Test returning same share - assertEquals(url, feature.toUploadUrl(sourceFolder, null, new DisabledPasswordCallback() { + assertEquals(url, feature.toUploadUrl(sourceFolder, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback() { @Override public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) { return new Credentials(null, new AlphanumericRandomStringService().random()); diff --git a/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveSharingUrlProvider.java b/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveSharingUrlProvider.java index a11439302c0..c3d566dec5c 100644 --- a/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveSharingUrlProvider.java +++ b/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveSharingUrlProvider.java @@ -46,14 +46,14 @@ public boolean isSupported(final Path file, final Type type) { } @Override - public DescriptiveUrl toDownloadUrl(final Path file, final Object options, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toDownloadUrl(final Path file, final Sharee sharee, final Object options, final PasswordCallback callback) throws BackgroundException { final Permission permission = new Permission(); // To make a file public you will need to assign the role reader to the type anyone permission.setRole("reader"); permission.setType("anyone"); try { session.getClient().permissions().create(fileid.getFileId(file), permission) - .setSupportsAllDrives(new HostPreferences(session.getHost()).getBoolean("googledrive.teamdrive.enable")).execute(); + .setSupportsAllDrives(new HostPreferences(session.getHost()).getBoolean("googledrive.teamdrive.enable")).execute(); } catch(IOException e) { throw new DriveExceptionMappingService(fileid).map("Failure to write attributes of {0}", e, file); @@ -62,7 +62,7 @@ public DescriptiveUrl toDownloadUrl(final Path file, final Object options, final } @Override - public DescriptiveUrl toUploadUrl(final Path file, final Object options, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toUploadUrl(final Path file, final Sharee sharee, final Object options, final PasswordCallback callback) throws BackgroundException { return DescriptiveUrl.EMPTY; } } diff --git a/googledrive/src/test/java/ch/cyberduck/core/googledrive/DriveSharingUrlProviderTest.java b/googledrive/src/test/java/ch/cyberduck/core/googledrive/DriveSharingUrlProviderTest.java index 66132081f72..bf989435f0a 100644 --- a/googledrive/src/test/java/ch/cyberduck/core/googledrive/DriveSharingUrlProviderTest.java +++ b/googledrive/src/test/java/ch/cyberduck/core/googledrive/DriveSharingUrlProviderTest.java @@ -46,7 +46,7 @@ public void toDownloadUrl() throws Exception { test.setAttributes(new DriveAttributesFinderFeature(session, fileid).find(test)); assertFalse(provider.isSupported(test, PromptUrlProvider.Type.upload)); assertTrue(provider.isSupported(test, PromptUrlProvider.Type.download)); - final DescriptiveUrl url = provider.toDownloadUrl(test, null, new DisabledPasswordCallback()); + final DescriptiveUrl url = provider.toDownloadUrl(test, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback()); assertNotEquals(DescriptiveUrl.EMPTY, url); assertNotNull(url.getUrl()); new DriveDeleteFeature(session, fileid).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); diff --git a/googlestorage/src/main/java/ch/cyberduck/core/googlestorage/GoogleStoragePublicUrlProvider.java b/googlestorage/src/main/java/ch/cyberduck/core/googlestorage/GoogleStoragePublicUrlProvider.java index 8fb38d8724b..89fba4e93ee 100644 --- a/googlestorage/src/main/java/ch/cyberduck/core/googlestorage/GoogleStoragePublicUrlProvider.java +++ b/googlestorage/src/main/java/ch/cyberduck/core/googlestorage/GoogleStoragePublicUrlProvider.java @@ -42,7 +42,7 @@ public boolean isSupported(final Path file, final Type type) { } @Override - public DescriptiveUrl toDownloadUrl(final Path file, final Void options, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toDownloadUrl(final Path file, final Sharee sharee, final Void options, final PasswordCallback callback) throws BackgroundException { final GoogleStorageAccessControlListFeature acl = new GoogleStorageAccessControlListFeature(session); final Acl permission = acl.getPermission(file); final Acl.GroupUser everyone = new Acl.GroupUser(Acl.GroupUser.EVERYONE); @@ -55,7 +55,7 @@ public DescriptiveUrl toDownloadUrl(final Path file, final Void options, final P } @Override - public DescriptiveUrl toUploadUrl(final Path file, final Void options, final PasswordCallback callback) { + public DescriptiveUrl toUploadUrl(final Path file, final Sharee sharee, final Void options, final PasswordCallback callback) { return DescriptiveUrl.EMPTY; } } diff --git a/nextcloud/src/main/java/ch/cyberduck/core/nextcloud/NextcloudShareProvider.java b/nextcloud/src/main/java/ch/cyberduck/core/nextcloud/NextcloudShareProvider.java index 362d51e8297..17b2420c310 100644 --- a/nextcloud/src/main/java/ch/cyberduck/core/nextcloud/NextcloudShareProvider.java +++ b/nextcloud/src/main/java/ch/cyberduck/core/nextcloud/NextcloudShareProvider.java @@ -83,7 +83,7 @@ public boolean isSupported(final Path file, final Type type) { * int) 0 = user; 1 = group; 3 = public link; 6 = federated cloud share */ @Override - public DescriptiveUrl toDownloadUrl(final Path file, final Object options, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toDownloadUrl(final Path file, final Sharee sharee, final Object options, final PasswordCallback callback) throws BackgroundException { final Host bookmark = session.getHost(); final StringBuilder request = new StringBuilder(String.format("https://%s/ocs/v2.php/apps/files_sharing/api/v1/shares?path=%s&shareType=%d", bookmark.getHostname(), @@ -134,7 +134,7 @@ public URI handleEntity(final HttpEntity entity) throws IOException { @Override - public DescriptiveUrl toUploadUrl(final Path file, final Object options, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toUploadUrl(final Path file, final Sharee sharee, final Object options, final PasswordCallback callback) throws BackgroundException { final Host bookmark = session.getHost(); final StringBuilder request = new StringBuilder(String.format("https://%s/ocs/v2.php/apps/files_sharing/api/v1/shares", bookmark.getHostname() diff --git a/nextcloud/src/test/java/ch/cyberduck/core/nextcloud/NextcloudShareProviderTest.java b/nextcloud/src/test/java/ch/cyberduck/core/nextcloud/NextcloudShareProviderTest.java index 6c08a22bb0a..60ce743c779 100644 --- a/nextcloud/src/test/java/ch/cyberduck/core/nextcloud/NextcloudShareProviderTest.java +++ b/nextcloud/src/test/java/ch/cyberduck/core/nextcloud/NextcloudShareProviderTest.java @@ -53,7 +53,7 @@ public void testIsSupported() { public void testToDownloadUrlNoPassword() throws Exception { final Path home = new NextcloudHomeFeature(session.getHost()).find(); final Path file = new DAVTouchFeature(session).touch(new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus()); - final DescriptiveUrl url = new NextcloudShareProvider(session).toDownloadUrl(file, null, new DisabledPasswordCallback()); + final DescriptiveUrl url = new NextcloudShareProvider(session).toDownloadUrl(file, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback()); assertNotSame(DescriptiveUrl.EMPTY, url); new DAVDeleteFeature(session).delete(Collections.singletonList(file), new DisabledPasswordCallback(), new Delete.DisabledCallback()); } @@ -62,7 +62,7 @@ public void testToDownloadUrlNoPassword() throws Exception { public void testToUploadUrlNoPassword() throws Exception { final Path home = new NextcloudHomeFeature(session.getHost()).find(); final Path folder = new DAVDirectoryFeature(session).mkdir(new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus()); - final DescriptiveUrl url = new NextcloudShareProvider(session).toUploadUrl(folder, null, new DisabledPasswordCallback()); + final DescriptiveUrl url = new NextcloudShareProvider(session).toUploadUrl(folder, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback()); assertNotSame(DescriptiveUrl.EMPTY, url); new DAVDeleteFeature(session).delete(Collections.singletonList(folder), new DisabledPasswordCallback(), new Delete.DisabledCallback()); } @@ -72,7 +72,7 @@ public void testToDownloadUrlPasswordTooShort() throws Exception { final Path home = new NextcloudHomeFeature(session.getHost()).find(); final Path folder = new DAVDirectoryFeature(session).mkdir(new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus()); try { - new NextcloudShareProvider(session).toDownloadUrl(folder, null, new DisabledPasswordCallback() { + new NextcloudShareProvider(session).toDownloadUrl(folder, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback() { @Override public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) { return new Credentials(null, new AlphanumericRandomStringService(5).random()); @@ -90,7 +90,7 @@ public Credentials prompt(final Host bookmark, final String title, final String public void testToDownloadUrlPassword() throws Exception { final Path home = new NextcloudHomeFeature(session.getHost()).find(); final Path file = new DAVTouchFeature(session).touch(new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus()); - final DescriptiveUrl url = new NextcloudShareProvider(session).toDownloadUrl(file, null, new DisabledPasswordCallback() { + final DescriptiveUrl url = new NextcloudShareProvider(session).toDownloadUrl(file, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback() { @Override public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) { return new Credentials(null, new AlphanumericRandomStringService(10).random()); @@ -104,7 +104,7 @@ public Credentials prompt(final Host bookmark, final String title, final String public void testToDownloadShareRoot() throws Exception { final Path home = new NextcloudHomeFeature(session.getHost()).find(); try { - new NextcloudShareProvider(session).toDownloadUrl(home, null, new DisabledPasswordCallback() { + new NextcloudShareProvider(session).toDownloadUrl(home, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback() { @Override public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) { return new Credentials(null, new AlphanumericRandomStringService(10).random()); @@ -121,7 +121,7 @@ public Credentials prompt(final Host bookmark, final String title, final String public void testToUploadUrl() throws Exception { final Path home = new NextcloudHomeFeature(session.getHost()).find(); final Path folder = new DAVDirectoryFeature(session).mkdir(new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus()); - final DescriptiveUrl url = new NextcloudShareProvider(session).toUploadUrl(folder, null, new DisabledPasswordCallback() { + final DescriptiveUrl url = new NextcloudShareProvider(session).toUploadUrl(folder, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback() { @Override public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) { return new Credentials(null, new AlphanumericRandomStringService(10).random()); @@ -136,7 +136,7 @@ public void testToUploadUrlPasswordTooShort() throws Exception { final Path home = new NextcloudHomeFeature(session.getHost()).find(); final Path folder = new DAVDirectoryFeature(session).mkdir(new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus()); try { - new NextcloudShareProvider(session).toUploadUrl(folder, null, new DisabledPasswordCallback() { + new NextcloudShareProvider(session).toUploadUrl(folder, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback() { @Override public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) { return new Credentials(null, new AlphanumericRandomStringService(5).random()); diff --git a/onedrive/src/main/java/ch/cyberduck/core/onedrive/features/GraphPromptUrlProvider.java b/onedrive/src/main/java/ch/cyberduck/core/onedrive/features/GraphPromptUrlProvider.java index dcc2c751671..993aa322a4a 100644 --- a/onedrive/src/main/java/ch/cyberduck/core/onedrive/features/GraphPromptUrlProvider.java +++ b/onedrive/src/main/java/ch/cyberduck/core/onedrive/features/GraphPromptUrlProvider.java @@ -49,12 +49,12 @@ public boolean isSupported(Path file, Type type) { } @Override - public DescriptiveUrl toDownloadUrl(Path file, Object options, PasswordCallback callback) - throws BackgroundException { + public DescriptiveUrl toDownloadUrl(Path file, final Sharee sharee, Object options, PasswordCallback callback) + throws BackgroundException { final DriveItem item = session.getItem(file); try { return new DescriptiveUrl(URI.create(Files.createSharedLink(item, OneDriveSharingLink.Type.VIEW).getLink().getWebUrl()), - DescriptiveUrl.Type.signed, MessageFormat.format(LocaleFactory.localizedString("{0} URL"), LocaleFactory.localizedString("Pre-Signed", "S3"))); + DescriptiveUrl.Type.signed, MessageFormat.format(LocaleFactory.localizedString("{0} URL"), LocaleFactory.localizedString("Pre-Signed", "S3"))); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map(e, file); @@ -65,7 +65,7 @@ public DescriptiveUrl toDownloadUrl(Path file, Object options, PasswordCallback } @Override - public DescriptiveUrl toUploadUrl(Path file, Object options, PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toUploadUrl(Path file, final Sharee sharee, Object options, PasswordCallback callback) throws BackgroundException { return DescriptiveUrl.EMPTY; } } diff --git a/onedrive/src/test/java/ch/cyberduck/core/onedrive/GraphPromptUrlProviderTest.java b/onedrive/src/test/java/ch/cyberduck/core/onedrive/GraphPromptUrlProviderTest.java index b532abd3df9..30e90e780cb 100644 --- a/onedrive/src/test/java/ch/cyberduck/core/onedrive/GraphPromptUrlProviderTest.java +++ b/onedrive/src/test/java/ch/cyberduck/core/onedrive/GraphPromptUrlProviderTest.java @@ -21,6 +21,7 @@ import ch.cyberduck.core.DisabledPasswordCallback; import ch.cyberduck.core.Path; import ch.cyberduck.core.features.Delete; +import ch.cyberduck.core.features.PromptUrlProvider; import ch.cyberduck.core.onedrive.features.GraphDeleteFeature; import ch.cyberduck.core.onedrive.features.GraphPromptUrlProvider; import ch.cyberduck.core.onedrive.features.GraphTouchFeature; @@ -42,7 +43,7 @@ public class GraphPromptUrlProviderTest extends AbstractOneDriveTest { public void toUrl() throws Exception { final Path file = new Path(new OneDriveHomeFinderService().find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); new GraphTouchFeature(session, fileid).touch(file, new TransferStatus().withMime("x-application/cyberduck")); - assertNotEquals(DescriptiveUrl.EMPTY, new GraphPromptUrlProvider(session).toDownloadUrl(file, null, new DisabledPasswordCallback())); + assertNotEquals(DescriptiveUrl.EMPTY, new GraphPromptUrlProvider(session).toDownloadUrl(file, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback())); new GraphDeleteFeature(session, fileid).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback()); } } diff --git a/s3/src/main/java/ch/cyberduck/core/s3/S3PublicUrlProvider.java b/s3/src/main/java/ch/cyberduck/core/s3/S3PublicUrlProvider.java index 58a0e491593..5ab4302e99f 100644 --- a/s3/src/main/java/ch/cyberduck/core/s3/S3PublicUrlProvider.java +++ b/s3/src/main/java/ch/cyberduck/core/s3/S3PublicUrlProvider.java @@ -45,7 +45,7 @@ public boolean isSupported(final Path file, final Type type) { } @Override - public DescriptiveUrl toDownloadUrl(final Path file, final Void options, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toDownloadUrl(final Path file, final Sharee sharee, final Void options, final PasswordCallback callback) throws BackgroundException { final Acl permission = acl.getPermission(file); final Acl.GroupUser everyone = new Acl.GroupUser(Acl.GroupUser.EVERYONE); final Acl.Role read = new Acl.Role(Permission.PERMISSION_READ.toString()); @@ -57,7 +57,7 @@ public DescriptiveUrl toDownloadUrl(final Path file, final Void options, final P } @Override - public DescriptiveUrl toUploadUrl(final Path file, final Void options, final PasswordCallback callback) { + public DescriptiveUrl toUploadUrl(final Path file, final Sharee sharee, final Void options, final PasswordCallback callback) { return DescriptiveUrl.EMPTY; } } diff --git a/s3/src/test/java/ch/cyberduck/core/s3/S3PublicUrlProviderTest.java b/s3/src/test/java/ch/cyberduck/core/s3/S3PublicUrlProviderTest.java index 03a1ff03198..ae148be07fe 100644 --- a/s3/src/test/java/ch/cyberduck/core/s3/S3PublicUrlProviderTest.java +++ b/s3/src/test/java/ch/cyberduck/core/s3/S3PublicUrlProviderTest.java @@ -44,7 +44,7 @@ public void toDownloadUrl() throws Exception { final S3PublicUrlProvider provider = new S3PublicUrlProvider(session, new S3AccessControlListFeature(session)); assertFalse(provider.isSupported(bucket, PromptUrlProvider.Type.download)); assertTrue(provider.isSupported(test, PromptUrlProvider.Type.download)); - final DescriptiveUrl url = provider.toDownloadUrl(test, null, new DisabledPasswordCallback()); + final DescriptiveUrl url = provider.toDownloadUrl(test, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback()); assertNotEquals(DescriptiveUrl.EMPTY, url); assertNotNull(url.getUrl()); new S3DefaultDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); diff --git a/storegate/src/main/java/ch/cyberduck/core/storegate/StoregateShareFeature.java b/storegate/src/main/java/ch/cyberduck/core/storegate/StoregateShareFeature.java index e09955e0d65..f10aa5621f3 100644 --- a/storegate/src/main/java/ch/cyberduck/core/storegate/StoregateShareFeature.java +++ b/storegate/src/main/java/ch/cyberduck/core/storegate/StoregateShareFeature.java @@ -50,7 +50,7 @@ public boolean isSupported(final Path file, final Type type) { } @Override - public DescriptiveUrl toDownloadUrl(final Path file, final Void options, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toDownloadUrl(final Path file, final Sharee sharee, final Void options, final PasswordCallback callback) throws BackgroundException { try { final Host bookmark = session.getHost(); final CreateFileShareRequest request = new CreateFileShareRequest() @@ -68,7 +68,7 @@ public DescriptiveUrl toDownloadUrl(final Path file, final Void options, final P } @Override - public DescriptiveUrl toUploadUrl(final Path file, final Void options, final PasswordCallback callback) throws BackgroundException { + public DescriptiveUrl toUploadUrl(final Path file, final Sharee sharee, final Void options, final PasswordCallback callback) throws BackgroundException { try { final Host bookmark = session.getHost(); final CreateFileShareRequest request = new CreateFileShareRequest() diff --git a/storegate/src/test/java/ch/cyberduck/core/storegate/StoregateShareFeatureTest.java b/storegate/src/test/java/ch/cyberduck/core/storegate/StoregateShareFeatureTest.java index dab8e1494c0..b4996dbd713 100644 --- a/storegate/src/test/java/ch/cyberduck/core/storegate/StoregateShareFeatureTest.java +++ b/storegate/src/test/java/ch/cyberduck/core/storegate/StoregateShareFeatureTest.java @@ -19,6 +19,7 @@ import ch.cyberduck.core.DisabledPasswordCallback; import ch.cyberduck.core.Path; import ch.cyberduck.core.features.Delete; +import ch.cyberduck.core.features.PromptUrlProvider; import ch.cyberduck.core.transfer.TransferStatus; import ch.cyberduck.test.IntegrationTest; @@ -43,7 +44,7 @@ public void toDownloadUrl() throws Exception { EnumSet.of(Path.Type.directory, Path.Type.volume)), new TransferStatus()); final Path test = new StoregateTouchFeature(session, nodeid).touch( new Path(room, String.format("%s", new AlphanumericRandomStringService().random()), EnumSet.of(Path.Type.file)), new TransferStatus()); - assertNotNull(new StoregateShareFeature(session, nodeid).toDownloadUrl(test, null, new DisabledPasswordCallback()).getUrl()); + assertNotNull(new StoregateShareFeature(session, nodeid).toDownloadUrl(test, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback()).getUrl()); new StoregateDeleteFeature(session, nodeid).delete(Collections.singletonList(room), new DisabledPasswordCallback(), new Delete.DisabledCallback()); } @@ -53,7 +54,7 @@ public void toUploadUrl() throws Exception { final Path room = new StoregateDirectoryFeature(session, nodeid).mkdir( new Path(String.format("/My files/%s", new AlphanumericRandomStringService().random()), EnumSet.of(Path.Type.directory, Path.Type.volume)), new TransferStatus()); - assertNotNull(new StoregateShareFeature(session, nodeid).toUploadUrl(room, null, new DisabledPasswordCallback()).getUrl()); + assertNotNull(new StoregateShareFeature(session, nodeid).toUploadUrl(room, PromptUrlProvider.Sharee.world, null, new DisabledPasswordCallback()).getUrl()); new StoregateDeleteFeature(session, nodeid).delete(Collections.singletonList(room), new DisabledPasswordCallback(), new Delete.DisabledCallback()); } }