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

Adding tags via updateFileMetadata adds tag_word to the tags #1769

Open
stijn22 opened this issue Jun 6, 2016 · 1 comment
Open

Adding tags via updateFileMetadata adds tag_word to the tags #1769

stijn22 opened this issue Jun 6, 2016 · 1 comment

Comments

@stijn22
Copy link

stijn22 commented Jun 6, 2016

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();
}
@zipwiz
Copy link
Contributor

zipwiz commented Jun 20, 2016

this may be the same as #1636 (other candidate: #1685 )

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants