Fixed File does not appear to be a valid add-on archive as expected

AndyB

Well-known member
Affected version
XF v2.1 Beta 4
When I go to Admin -> Add-ons and try to install one of my add-ons using the new:

190159

button, I select a file like this

190160

Then I click the Upload button and I get this:

190161

I tried a couple different add-ons but I always get the same result. These add-ons were created on the same server and can install without issue the normal way when I just upload them to the src/Andy folder.
 
Are you sure you're including the full upload/src/addons/Andy/InsertAttachment/addon.json path inside the zip file?
Because this:
can install without issue the normal way when I just upload them to the src/Andy folder.
Indicates that you're trying to upload a zip file with the structure upload/InsertAttachment/addon.json which is never going to work.


Fillip
 
Are you sure you're including the full upload/src/addons/Andy/InsertAttachment/addon.json path inside the zip file?

The full path is included. Here's a screenshot of the zip file which has been unzipped on my iMac.

190191

The add-on is built using the XF CLI command:

php cmd.php xf-addon:build-release Andy/InsertAttachment
 
I got this error when installing this add-on.
I did unzip, and then again zipped.
Problem solved.

I think it's a problem in compressing the add-on
The content of some compressed folders does not appear and I've observed that the add-ons in this case have problems.

190236
190237
@XDinc
 
Last edited:
The full path is included. Here's a screenshot of the zip file which has been unzipped on my iMac.

View attachment 190191

The add-on is built using the XF CLI command:

php cmd.php xf-addon:build-release Andy/InsertAttachment
Which version of XF built the add-on, exactly? If it was XF 2.0.10 or XF 2.0.11 and the fix(es) from this thread were not applied then that might be the reason:
 
That would be unexpected because in my testing on both macOS and Windows building an add-on in Beta 4 works as expected and results in an installable archive.

Could you try again and ensure it is definitely Beta 4 you're using and ensure that you're then attempting to install using the correct zip?

Failing that, could you send the Zip through to me so I can see if there's anything else going wrong?
 
Thank you for reporting this issue. The issue is now resolved and we are aiming to include that in a future XF release (2.1.0 Beta 5).

Change log:
When locating an addon.json file within an add-on archive, check for false instead.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
Diff:
diff --git a/src/XF/Service/AddOnArchive/Validator.php b/src/XF/Service/AddOnArchive/Validator.php
index 8d73bfd553..881cc5715c 100644
--- a/src/XF/Service/AddOnArchive/Validator.php
+++ b/src/XF/Service/AddOnArchive/Validator.php
@@ -72,7 +72,7 @@ public function validate(&$error = null)
         $zip = $this->zip();
         $jsonFile = $this->getZipAddOnRootDir() . "/addon.json";
 
-        if (!$zip->locateName($jsonFile))
+        if ($zip->locateName($jsonFile) === false)
         {
             $error = \XF::phrase('file_does_not_appear_to_be_valid_add_on_archive_as_expected');
             return false;
 
Back
Top Bottom