Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-87179

Google Cloud Vision Auto Tag Provider sends the wrong JSON payload

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: Master
    • Fix Version/s: Master
    • Component/s: DM, DM > Auto Tagging
    • Labels:
      None

      Description

      Steps to reproduce:

      1. Go to master private.
      2. Enable Asset Auto Tagging in "System Settings --> Assets
      3. Enable the Google Cloud Vision Auto Tag Provider in "System Settings --> Documents And Media" with a valid API Key (https://cloud.google.com/docs/authentication/api-keys).
      4. Add an image to the document library.

      Expected: The image is tagged by google cloud vision.
      Actual: The image is not tagged and an error is displayed in the logs.

      What is actually happening is that we are building a malformed JSON string:

      This is what we should be sending:

      {"requests":[{"features":[{"type":"LABEL_DETECTION"}],"image":{"content":"ODFvcWZEaWo...="}}]}>
      

      But we are sending something like:

      {"requests":["{\"features\":[\"{\\\"type\\\":\\\"LABEL_DETECTION\\\"}\"],\"image\":{\"content\":\"ODFvcWZEaWo=\"}}"]}
      

      The problem is that the call we use to create an inline JSON array is passing the value as an Object instead of a JSONObject which ends up being serialized as a String.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  6 weeks, 4 days ago