ReferenceEntityMediaFileAPI has incorrect header code for Akeneo Serenity
Closed this issue · 3 comments
Hi,
While building a migration using this app, I discovered the writing of files to reference entities was failing. I traced the error down to the following line of code:
src/Api/ReferenceEntityMediaFileApi.php
The issue is extractCodeFromCreationResponse looks for this header:
!isset($headers['Reference-entities-media-file-code'][0]
The case is wrong on that header, and it works when manually changed to:
!isset($headers['Reference-Entities-Media-File-Code'][0]
I will submit a PR for this, but I noticed there was a similar PR #97 merged in with the incorrect header. Does this header change per Akeneo version?
For quick reference, in Akeneo EE 5.the headers are set here:
$headers = [ 'Reference-entities-media-file-code' => $fileInfo->getKey(), 'Location' => $downloadMediaFileUrl ];
That's line 63 in src/Akeneo/ReferenceEntity/back/Infrastructure/Connector/Api/MediaFile/UploadMediaFileAction.php
So the issue with php-api is limited to Serenity, and my fix would actively break it for a user of 5.x EE.
Hello @geoclimber4 ,
Are you using the latest version of the client? This issue was fixed in #98, and should be available for v6.0.2.
Just did a fresh compose and the issue looks fixed, thank you!