Problem/Motivation
Hi, I have a problem with invalid file revisions returned on their JSON:API resources.
I have a media type called Document
, which can be translated to EN and NB languages. This media type is used mostly for uploading PDF files, but I need a different PDF for EN and NB language. For EN translations (which is a default language) everything works good, but it doesn't for NB language.
Steps to reproduce
- Create
Document
media type.
- Add
File
field and make it translatable (for ex. to EN and NB langauges).
- Create a
Document
media and add some PDF file in it (for ex. en.pdf
).
- Translate this media and add a different PDF file in it (for ex.
nb-01.pdf
).
- Edit second translation, remove its file and upload a new one (for ex.
nb-02.pdf
).
- Go to
/en/jsonapi/media/document
resource and compare it with /nb/jsonapi/media/document
resource.
Now, if you go to those resources, find the corresponding media, in my case (for NB lang):
{
"type": "media--document",
...
"relationships": {
"field_media_file": {
"data": {
"type": "file--file",
...
},
"links": {
"related": {
"href": "http://localhost:8080/nb/jsonapi/media/document/5982ce2e-68ee-453d-88b7-4097702760b0/field_media_file?resourceVersion=id%3A721"
},
}
}
}
}
Let's focus on relationships.field_media_file.links.related.href
... if you go to this resource "http://localhost:8080/nb/jsonapi/media/document/5982ce2e-68ee-453d-88b7-4097702760b0/field_media_file?resourceVersion=id%3A721"
you should see an old/previous version of the PDF file for NB lang ... so a nb-01.pdf
file, instead of nb-02.pdf
.
For EN language I didn't notice such issue, everything looks to be OK here.
What's interesting, if you go to the file resource without resourceVersion
param in the URL (http://localhost:8080/nb/jsonapi/media/document/5982ce2e-68ee-453d-88b7-4097702760b0/field_media_file
) then it works correctly.