Skip to content
This repository was archived by the owner on Jan 21, 2024. It is now read-only.
This repository was archived by the owner on Jan 21, 2024. It is now read-only.

Adding tags via updateFileMetadata adds tag_word to the tags #1769

@stijn22

Description

@stijn22

Hi,

I am trying to add tags to a file via the updateFileMetadata method provided by FileService. However, when adding a tag, for example tag1, to a file, the tag tag_word is also automatically added. The problem also occurs with updateCommunityFileMetadata. This is my method for adding tags to a file:

public static void updateFileMetaData(final Connection connection, final String communityId, final File file, final List<String> tags)
{
    final FileService service                               = new FileService(connection.getEndpoint());
    Map<String, String> paramsMap                           = null;

    if (tags != null)                                       { paramsMap = buildFileTags(tags); }

    try
    {
        if (paramsMap != null)
        {
            if (communityId.isEmpty())                      { service.updateFileMetadata(file, paramsMap); }
            else                                            { service.updateCommunityFileMetadata(file, file.getLibraryId(), paramsMap); }
        }
    }
    catch (final ClientServicesException e)                 { throw new RuntimeException(e); }
}

public static Map<String, String> buildFileTags(final List<String> tags)
{
    final FileCreationParameters p                          = new FileCreationParameters();

    for (final String tag : tags)                           { p.tags.add(tag); }

    return p.buildParameters();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions