contentful.py icon indicating copy to clipboard operation
contentful.py copied to clipboard

Embedded Asset in rich text field is not localized when using locale's wildcard

Open mark-mishyn opened this issue 2 years ago • 2 comments

When I'm requesting Entry or building it with ResourceBuilder().build() I'm facing strange behavior -- embedded assets are not localized.

During debugging I've checked raw API response and I see correct asset's URLs are there, but seems like there is some sort of a bug.

Complete example how to reproduce the bug is bellow.

def foo():
    client = contentful.Client(
        "xyz",
        "xyz",
        default_locale="en-US",
        api_url="preview.contentful.com",
    )
    entry = client.entry('qwerty12345', {"locale": "*"})

    # here rich text field contains Portuguese text, but embedded Asset is for default language (en-US)
    rich_text_field = entry.fields(locale='pt')['text']

Client version is contentful==1.13.1

mark-mishyn avatar Mar 23 '22 08:03 mark-mishyn

Hi @mark-mishyn, thanks for reporting the issue. It has been a while since you reported the issue. Did you find the bug/problem or fix yet?

rubydog avatar Oct 13 '22 00:10 rubydog

@rubydog I ended with fork and this ugly hot fix... but still use it in prod for almost a year:) https://github.com/contentful/contentful.py/commit/1a1e4f0f9b938590925fc4859fb7e89f31506437?diff=split

mark-mishyn avatar Jan 19 '23 14:01 mark-mishyn