@Override
    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));
            }
            if(null == options) {
                options = new CreateUploadShareRequest();
                log.warn(String.format("Use default share options %s", options));
            }
            final Host bookmark = session.getHost();
            final UploadShare share = new SharesApi(session.getClient()).createUploadShare(
                    options.targetId(Long.parseLong(nodeid.getVersionId(file))), StringUtils.EMPTY, null);
            final String help;
            if(null == share.getExpireAt()) {
                help = MessageFormat.format(LocaleFactory.localizedString("{0} URL"), LocaleFactory.localizedString("Pre-Signed", "S3"));
            }
            else {
                final long expiry = share.getExpireAt().getMillis();
                help = MessageFormat.format(LocaleFactory.localizedString("{0} URL"), LocaleFactory.localizedString("Pre-Signed", "S3")) + " (" + MessageFormat.format(LocaleFactory.localizedString("Expires {0}", "S3") + ")",
                        UserDateFormatterFactory.get().getShortFormat(expiry * 1000)
                );
            }
            final Matcher matcher = Pattern.compile(SDSSession.VERSION_REGEX).matcher(session.softwareVersion().getRestApiVersion());
            if(matcher.matches()) {
                if(new Version(matcher.group(1)).compareTo(new Version("4.26")) < 0) {
                    return new DescriptiveUrl(URI.create(String.format("%s://%s/#/public/shares-uploads/%s",
                            bookmark.getProtocol().getScheme(),
                            bookmark.getHostname(),
                            share.getAccessKey())),
                            DescriptiveUrl.Type.signed, help);
                }
            }
            return new DescriptiveUrl(URI.create(String.format("%s://%s/public/upload-shares/%s",
                    bookmark.getProtocol().getScheme(),
                    bookmark.getHostname(),
                    share.getAccessKey())),
                    DescriptiveUrl.Type.signed, help);
        }
        catch(ApiException e) {
            throw new SDSExceptionMappingService(nodeid).map(e);
        }
    }
@Test
    public void testUploadAccountEncrypted() throws Exception {
        final SDSNodeIdProvider nodeid = new SDSNodeIdProvider(session);
        final Path room = new SDSDirectoryFeature(session, nodeid).createRoom(
                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 SDSShareFeature(session, nodeid).toUploadUrl(folder,
                Share.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());
        assertNotEquals(DescriptiveUrl.EMPTY, url);
        assertEquals(DescriptiveUrl.Type.signed, url.getType());
        assertTrue(url.getUrl().startsWith("https://duck.dracoon.com/public/upload-shares/"));
        new SDSDeleteFeature(session, nodeid).delete(Collections.singletonList(room), new DisabledLoginCallback(), new Delete.DisabledCallback());
    }