Cyberduck Mountain Duck CLI

Changeset 43250


Ignore:
Timestamp:
Nov 7, 2017 4:06:37 PM (8 months ago)
Author:
robot
Message:

Fix #9928. Enable Team Drive support.

Location:
shelves/10.2017
Files:
9 edited
1 copied

Legend:

Unmodified
Added
Removed
  • shelves/10.2017/googledrive/src/main/java/ch/cyberduck/core/googledrive/AbstractDriveListService.java

    r42658 r43250  
    7676            do {
    7777                final FileList list = session.getClient().files().list()
     78                    // Whether Team Drive items should be included in results
     79                    .setIncludeTeamDriveItems(true)
     80                    // Whether the requesting application supports Team Drives
     81                    .setSupportsTeamDrives(true)
    7882                    .setQ(this.query(directory, listener))
    7983                    .setOrderBy("name")
  • shelves/10.2017/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveCopyFeature.java

    r42539 r43250  
    2323import ch.cyberduck.core.exception.BackgroundException;
    2424import ch.cyberduck.core.features.Copy;
     25import ch.cyberduck.core.preferences.PreferencesFactory;
    2526import ch.cyberduck.core.transfer.TransferStatus;
    2627
     
    4344            final File copy = session.getClient().files().copy(new DriveFileidProvider(session).getFileid(source, new DisabledListProgressListener()), new File()
    4445                    .setParents(Collections.singletonList(new DriveFileidProvider(session).getFileid(target.getParent(), new DisabledListProgressListener())))
    45                     .setName(target.getName())).execute();
     46                .setName(target.getName()))
     47                .setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute();
    4648            return new Path(target.getParent(), target.getName(), target.getType(),
    4749                    new PathAttributes(target.attributes()).withVersionId(copy.getId()));
  • shelves/10.2017/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveDeleteFeature.java

    r42292 r43250  
    2121import ch.cyberduck.core.exception.BackgroundException;
    2222import ch.cyberduck.core.features.Delete;
     23import ch.cyberduck.core.preferences.PreferencesFactory;
    2324
    2425import java.io.IOException;
     
    4142            callback.delete(file);
    4243            try {
    43                 session.getClient().files().delete(new DriveFileidProvider(session).getFileid(file, new DisabledListProgressListener())).execute();
     44                session.getClient().files().delete(new DriveFileidProvider(session).getFileid(file, new DisabledListProgressListener()))
     45                    .setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute();
    4446            }
    4547            catch(IOException e) {
  • shelves/10.2017/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveDirectoryFeature.java

    r41861 r43250  
    2222import ch.cyberduck.core.features.Directory;
    2323import ch.cyberduck.core.features.Write;
     24import ch.cyberduck.core.preferences.PreferencesFactory;
    2425import ch.cyberduck.core.transfer.TransferStatus;
    2526
     
    4647                    .setMimeType("application/vnd.google-apps.folder")
    4748                    .setParents(Collections.singletonList(new DriveFileidProvider(session).getFileid(folder.getParent(), new DisabledListProgressListener()))));
    48             final File execute = insert.execute();
     49            final File execute = insert
     50                .setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute();
    4951            return new Path(folder.getParent(), folder.getName(), folder.getType(), new PathAttributes(folder.attributes()));
    5052        }
  • shelves/10.2017/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveMetadataFeature.java

    r42695 r43250  
    2121import ch.cyberduck.core.exception.BackgroundException;
    2222import ch.cyberduck.core.features.Metadata;
     23import ch.cyberduck.core.preferences.PreferencesFactory;
    2324
    2425import java.io.IOException;
     
    4546        try {
    4647            final String fileid = new DriveFileidProvider(session).getFileid(file, new DisabledListProgressListener());
    47             final Map<String, String> properties = session.getClient().files().get(fileid).setFields("properties").execute().getProperties();
     48            final Map<String, String> properties = session.getClient().files().get(fileid).setFields("properties")
     49                .setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute().getProperties();
    4850            if(null == properties) {
    4951                return Collections.emptyMap();
     
    6264            final File body = new File();
    6365            body.setProperties(metadata);
    64             session.getClient().files().update(fileid, body).setFields("properties").execute();
     66            session.getClient().files().update(fileid, body).setFields("properties").
     67                setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute();
    6568        }
    6669        catch(IOException e) {
  • shelves/10.2017/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveMoveFeature.java

    r42868 r43250  
    2323import ch.cyberduck.core.features.Delete;
    2424import ch.cyberduck.core.features.Move;
     25import ch.cyberduck.core.preferences.PreferencesFactory;
    2526import ch.cyberduck.core.transfer.TransferStatus;
    2627
     
    6566                properties.setName(renamed.getName());
    6667                properties.setMimeType(status.getMime());
    67                 session.getClient().files().update(fileid, properties).execute();
     68                session.getClient().files().update(fileid, properties).
     69                    setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute();
    6870            }
    6971            // Retrieve the existing parents to remove
    7072            final StringBuilder previousParents = new StringBuilder();
    7173            final File reference = session.getClient().files().get(fileid)
    72                     .setFields("parents")
    73                     .execute();
     74                .setFields("parents")
     75                .setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable"))
     76                .execute();
    7477            for(String parent : reference.getParents()) {
    7578                previousParents.append(parent);
     
    7881            // Move the file to the new folder
    7982            session.getClient().files().update(fileid, null)
    80                     .setAddParents(new DriveFileidProvider(session).getFileid(renamed.getParent(), new DisabledListProgressListener()))
    81                     .setRemoveParents(previousParents.toString())
    82                     .setFields("id, parents")
    83                     .execute();
     83                .setAddParents(new DriveFileidProvider(session).getFileid(renamed.getParent(), new DisabledListProgressListener()))
     84                .setRemoveParents(previousParents.toString())
     85                .setFields("id, parents")
     86                .setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable"))
     87                .execute();
    8488            return new Path(renamed.getParent(), renamed.getName(), renamed.getType(),
    85                     new PathAttributes(renamed.attributes()).withVersionId(fileid));
     89                new PathAttributes(renamed.attributes()).withVersionId(fileid));
    8690        }
    8791        catch(IOException e) {
  • shelves/10.2017/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveQuotaFeature.java

    r35652 r43250  
    3838            final About about = session.getClient().about().get().setFields("user, storageQuota").execute();
    3939            final Long used = null == about.getStorageQuota().getUsage() ? 0L
    40                     : about.getStorageQuota().getUsage();
     40                : about.getStorageQuota().getUsage();
    4141            final Long available = null == about.getStorageQuota().getLimit() ? Long.MAX_VALUE
    42                     : about.getStorageQuota().getLimit() - used;
     42                : about.getStorageQuota().getLimit() - used;
    4343            return new Space(used, available);
    4444        }
    4545        catch(IOException e) {
    4646            throw new DriveExceptionMappingService().map("Failure to read attributes of {0}", e,
    47                     new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory)));
     47                new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory)));
    4848        }
    4949    }
  • shelves/10.2017/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveTimestampFeature.java

    r41164 r43250  
    1919import ch.cyberduck.core.Path;
    2020import ch.cyberduck.core.exception.BackgroundException;
     21import ch.cyberduck.core.preferences.PreferencesFactory;
    2122import ch.cyberduck.core.shared.DefaultTimestampFeature;
    2223
     
    4041            final File properties = new File();
    4142            properties.setModifiedTime(new DateTime(modified));
    42             session.getClient().files().update(fileid, properties).setFields("modifiedTime").execute();
     43            session.getClient().files().update(fileid, properties).setFields("modifiedTime").
     44                setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute();
    4345        }
    4446        catch(IOException e) {
  • shelves/10.2017/googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveTouchFeature.java

    r41164 r43250  
    2222import ch.cyberduck.core.features.Touch;
    2323import ch.cyberduck.core.features.Write;
     24import ch.cyberduck.core.preferences.PreferencesFactory;
    2425import ch.cyberduck.core.transfer.TransferStatus;
    2526
     
    5051                    .setMimeType(status.getMime())
    5152                    .setParents(Collections.singletonList(new DriveFileidProvider(session).getFileid(file.getParent(), new DisabledListProgressListener()))));
    52             final File execute = insert.execute();
     53            final File execute = insert.
     54                setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute();
    5355            return new Path(file.getParent(), file.getName(), file.getType(),
    5456                    new PathAttributes(file.attributes()).withVersionId(execute.getId()));
Note: See TracChangeset for help on using the changeset viewer.
swiss made software