Skip to content

fix(modules): read the module from the path id in startDownload and getDownloadStatus (#1250) - #1293

Merged
jorikfon merged 1 commit into
developfrom
1250-getdownloadstatus-uniqid-data-undefined
Oct 23, 2026
Merged

jorikfon merged 1 commit into
developfrom
1250-getdownloadstatus-uniqid-data-undefined

Conversation

@jorikfon

Copy link
Copy Markdown
Collaborator

Summary

REST v3 passes the module of /modules/{id}:getDownloadStatus and /modules/{id}:startDownload in data['id'], but ModulesManagementProcessor read only data['uniqid']. Every v3 call therefore failed with 422 Undefined array key "uniqid", not just the test. The processor now uses uniqid when it is a non-empty string and the path id otherwise; a non-string value (uniqid[]=x) is ignored instead of causing a TypeError. Both actions still reject an invalid id with 400 before any filesystem access.

Since #1161 the API ignores GET bodies, so the old test vector (unsafe uniqid in a GET JSON body) cannot reach PHP anymore. test_04 now sends the unsafe uniqid in the query string, and the new test_05 checks that the path id reaches the action.

Closes #1250

Verification

tests/api/test_39_modules.py against the local mikopbx-php83 container:

  • before the fix: test_05 fails with 422 Undefined array key "uniqid" (no body) and 422 TypeError (uniqid[]);
  • after the fix: 5 passed.

Code review: no findings.

…etDownloadStatus (#1250)

REST v3 puts the module of /modules/{id}:getDownloadStatus and :startDownload in data['id'], but the processor read only data['uniqid'], so every v3 call failed with 422 "Undefined array key". Use uniqid when it is a non-empty string, otherwise the path id; non-string values become ''. Both actions still reject a bad id with 400 before touching the filesystem.

Since #1161 GET bodies are ignored, so test_04 now sends the unsafe uniqid in the query; test_05 checks that the path id reaches the action.
@jorikfon
jorikfon merged commit a4a23c5 into develop Oct 23, 2026
2 checks passed
@jorikfon
jorikfon deleted the 1250-getdownloadstatus-uniqid-data-undefined branch October 23, 2026 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

getDownloadStatus без uniqid в data падает с Undefined array key вместо 400

1 participant