Skip to content
This repository was archived by the owner on Jun 18, 2021. It is now read-only.

Conversation

florian-besser
Copy link

@florian-besser florian-besser commented Apr 20, 2021

This should fix #45 and fix #60

By specifying the target locale of an asset to retrieve we can correctly handle the data given by contentful.

Sample contentful data used to test this PR with:

{
  "metadata": {
    "tags": []
  },
  "sys": {
    "space": {
      "sys": {
        "type": "Link",
        "linkType": "Space",
        "id": "censored"
      }
    },
    "id": "censored",
    "type": "Asset",
    "createdAt": "2021-03-02T11:25:00.594Z",
    "updatedAt": "2021-03-02T11:28:53.219Z",
    "environment": {
      "sys": {
        "id": "master",
        "type": "Link",
        "linkType": "Environment"
      }
    },
    "publishedVersion": 2,
    "publishedAt": "2021-03-02T11:28:53.219Z",
    "firstPublishedAt": "2021-03-02T11:28:53.219Z",
    "createdBy": {
      "sys": {
        "type": "Link",
        "linkType": "User",
        "id": "censored"
      }
    },
    "updatedBy": {
      "sys": {
        "type": "Link",
        "linkType": "User",
        "id": "censored"
      }
    },
    "publishedCounter": 1,
    "version": 3,
    "publishedBy": {
      "sys": {
        "type": "Link",
        "linkType": "User",
        "id": "censored"
      }
    }
  },
  "fields": {
    "title": {
      "id-ID": "Article-12.2 01"
    },
    "file": {
      "id-ID": {
        "url": "//images.ctfassets.net/censored/censored/censored/Article-12.2_01.jpg",
        "details": {
          "size": 415255,
          "image": {
            "width": 1080,
            "height": 1920
          }
        },
        "fileName": "Article-12.2_01.jpg",
        "contentType": "image/jpeg"
      }
    }
  }
}

Florian Besser added 3 commits April 20, 2021 13:45
@florian-besser florian-besser changed the title Allow retrieving locaized assets Allow retrieving localized assets Apr 20, 2021
@florian-besser

This comment has been minimized.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Wrong type casting in assets.go Assets do not seem to support locales correctly

1 participant