5.4
ZIP archive files are extracted
Extracting ZIP archive fails with two red errors:
Found in testing #47859 with JBT.
With Xdebug I see https://github.com/joomla/joomla-cms/blob/dc5ac482f8d927c1749ef97e43b2fc9fde926e13/administrator/components/com_templates/src/Model/TemplateModel.php#L1838-1847
$path = "/var/www/html/templates/cassiopeia/test/Heiko.zip"
$file = "Heiko.zip"
...
if (file_exists(Path::check($path . '/' . $fileName))) {
appends the file name a second time and therefore fails.
It may be introduced with #35998 in 4.1.0 and I am confused, if the issue is true, how then the PR that I am testing, was tested by the contributer?
I tested extracting ZIP in Joomla 4.0.6 is working and fails in 4.1.5.
No response
| Labels |
Added:
No Code Attached Yet
bug
|
||
Hmm, the code here indeed looks wrong (5.4-dev same as 6.1-dev):
joomla-cms/administrator/components/com_templates/src/Model/TemplateModel.php
Lines 1842 to 1847 in dc5ac48
Besides the fact that it uses base64_decode($file) 2 times instead of reusing $relPath the 2nd time, it appends '/' . $fileName to $path at 2 places, and that seems wrong to me as $path still includes the file name at the end.
So on 6.1-dev I can reproduce the issue as described.
However, on a current 5.4-dev branch I cannot reproduce it as the template manager does not allow to upload any unsafe files, e.g. PHP or Zip files.
For the reasons see the description in my PR #48080 .
The input filter already filters out the file name and so I get "No file was found." and "Failed to upload file.".
Hmm, the code here indeed looks wrong (5.4-dev same as 6.1-dev):
joomla-cms/administrator/components/com_templates/src/Model/TemplateModel.php
Lines 1842 to 1847 in dc5ac48
Besides the fact that it uses base64_decode($file) 2 times instead of reusing $relPath the 2nd time, it appends '/' . $fileName to $path at 2 places, and that seems wrong to me as $path still includes the file name at the end.
So on 6.1-dev I can reproduce the issue as described.
However, on a current 5.4-dev branch I cannot reproduce it as the template manager does not allow to upload any unsafe files, e.g. PHP or Zip files.
For the reasons see the description in my PR #48080 .
The input filter already filters out the file name and so I get "No file was found." and "Failed to upload file.".
Update: It seems the reason for that is because the Zip file which I have used contains a PHP file.
The issue should be fixed by PR ...
It definitely is fixed by that PR.
| Status | New | ⇒ | Closed |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2026-09-10 11:57:35 |
| Closed_By | ⇒ | muhme |
As the bug is very easy to reproduce, it would be great if someone else could confirm it.