RTC bug PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar AkameOuO
AkameOuO
18 Mar 2025

Pull Request for Issue # .

Summary of Changes

Call sendHeaders after headers are set.
And set status code with application instead of using http_response_code.

Testing Instructions

  • Open media manager.
  • Open browser devtools and watch response headers related to com_media api.

Actual result BEFORE applying this Pull Request

Content type is incorrect text/html.
image

Expected result AFTER applying this Pull Request

Content type is correct application/json, and other headers are also set.
image

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar AkameOuO AkameOuO - open - 18 Mar 2025
avatar AkameOuO AkameOuO - change - 18 Mar 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 18 Mar 2025
Category Administration com_media
avatar AkameOuO AkameOuO - change - 27 Mar 2025
Title
[5.2] Fix headers are not sent correctly in com_media api controller
[5.3] Fix headers are not sent correctly in com_media api controller
avatar AkameOuO AkameOuO - edited - 27 Mar 2025
avatar ceford ceford - test_item - 28 May 2025 - Tested successfully
avatar ceford
ceford - comment - 28 May 2025

I have tested this item ✅ successfully on e49301b

It took me a while to figure out exactly what to do: my browser URL

http://localhost/jcms-testing/administrator/index.php?option=com_media&format=json&mediatypes=0,1,2,3&task=api.files&path=local-images%3A%2Fpowered_by.png

Without the patch I could see Content Type: text/html and the visible response was just text but obviously json. With the patch the response was application/json and the browser nicely formatted the json for me.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45150.

avatar AkameOuO AkameOuO - change - 10 Sep 2025
Labels Added: bug PR-5.3-dev
avatar HLeithner
HLeithner - comment - 15 Oct 2025

This pull request has been automatically rebased to 5.4-dev.

avatar richard67 richard67 - change - 2 Nov 2025
Title
[5.3] Fix headers are not sent correctly in com_media api controller
[5.4] Fix headers are not sent correctly in com_media api controller
avatar richard67 richard67 - edited - 2 Nov 2025
avatar richard67 richard67 - change - 2 Nov 2025
Labels Added: PR-5.4-dev
Removed: PR-5.3-dev
avatar richard67 richard67 - alter_testresult - 2 Nov 2025 - ceford: Tested successfully
avatar richard67
richard67 - comment - 2 Nov 2025

I've restored @ceford 's test result in the issue tracker because the commits which invalidated the test count were just a typo fix in a code comment and a clean branch update after a clean rebase.

avatar muhme muhme - test_item - 7 Nov 2025 - Tested successfully
avatar muhme
muhme - comment - 7 Nov 2025

I have tested this item ✅ successfully on b574cc1

Tested with JBT, before the PR, Checked com_media URLs with &format=json have Response Header Content-Type: text/html but response is JSON, e.g.

Applied PR with Patch Tester

avatar muhme muhme - change - 7 Nov 2025
Status Pending Ready to Commit
avatar muhme
muhme - comment - 7 Nov 2025

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45150.

avatar richard67 richard67 - change - 8 Nov 2025
Labels Added: RTC
avatar richard67 richard67 - change - 8 Nov 2025
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2025-11-08 11:22:44
Closed_By richard67
avatar richard67 richard67 - close - 8 Nov 2025
avatar richard67 richard67 - merge - 8 Nov 2025
avatar richard67
richard67 - comment - 8 Nov 2025

Thanks @AkameOuO for this bug fix, and @ceford and @muhme for testing.

Add a Comment

Login with GitHub to post a comment