@Override
    public PathAttributes find(final Path file, final ListProgressListener listener) throws BackgroundException {
        if(file.isRoot()) {
            return PathAttributes.EMPTY;
        }
        if(new DefaultPathContainerService().isContainer(file)) {
            return PathAttributes.EMPTY;
        }
        final Path query;
        if(file.isPlaceholder()) {
            query = new Path(file.getParent(), FilenameUtils.removeExtension(file.getName()), file.getType(), file.attributes());
        }
        else {
            query = file;
        }
        final AttributedList<Path> list;
        if(new SimplePathPredicate(DriveHomeFinderService.SHARED_DRIVES_NAME).test(file.getParent())) {
            list = new DriveTeamDrivesListService(session, fileid).list(file.getParent(), listener);
        }
        else {
            list = new FileidDriveListService(session, fileid, query).list(file.getParent(), listener);
        }
        final Path found = list.find(new ListFilteringFeature.ListFilteringPredicate(session.getCaseSensitivity(), file));
        if(null == found) {
            throw new NotfoundException(file.getAbsolute());
        }
        return found.attributes();

    }
@Test
    public void testMissingShortcutTarget() throws Exception {
        final Path test = new Path(DriveHomeFinderService.MYDRIVE_FOLDER, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
        final DriveFileIdProvider fileid = new DriveFileIdProvider(session);
        new DriveTouchFeature(session, fileid).touch(test, new TransferStatus());
        final DriveAttributesFinderFeature f = new DriveAttributesFinderFeature(session, fileid);
        final PathAttributes attributes = f.find(test);
        final File shortcut = session.getClient().files().create(new File()
            .setName(new AlphanumericRandomStringService().random())
            .setMimeType("application/vnd.google-apps.shortcut")
            .setShortcutDetails(new File.ShortcutDetails()
                .setTargetMimeType("text/plain")
                .setTargetId(fileid.getFileId(test))
            )
        ).execute();
        assertEquals(attributes, f.find(new Path(DriveHomeFinderService.MYDRIVE_FOLDER, shortcut.getName(), EnumSet.of(Path.Type.file))));
        session.getClient().files().delete(fileid.getFileId(test))
            .setSupportsAllDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute();
        try {
            f.find(new Path(DriveHomeFinderService.MYDRIVE_FOLDER, shortcut.getName(), EnumSet.of(Path.Type.file)));
        }
        catch(NotfoundException e) {
            // Expected. Can no longer resolve shortcut
        }
        final AttributedList<Path> list = new DriveListService(session, fileid).list(DriveHomeFinderService.MYDRIVE_FOLDER, new DisabledListProgressListener());
        assertFalse(list.contains(test));
        assertNull(list.find(new SimplePathPredicate(new Path(DriveHomeFinderService.MYDRIVE_FOLDER, shortcut.getName(), EnumSet.of(Path.Type.file)))));
        session.getClient().files().delete(shortcut.getId())
            .setSupportsAllDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute();
    }