Closed Bug 880528 Opened 11 years ago Closed 11 years ago

validator fails to find resource in the archive

Categories

(addons.mozilla.org Graveyard :: Add-on Validation, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 880687
2013-06-13

People

(Reporter: clarkbw, Assigned: basta)

References

Details

I couldn't upload my add-on because there was an "Unexpected server error while validating."

Running it locally I get the following error:

Traceback (most recent call last):
  File "./addon-validator", line 6, in <module>
    validator.main.main()
  File "/Users/bclark/src/mozilla/amo-validator/validator/main.py", line 133, in main
    timeout=timeout)
  File "/Users/bclark/src/mozilla/amo-validator/validator/validate.py", line 82, in validate
    timeout=timeout)
  File "/Users/bclark/src/mozilla/amo-validator/validator/submain.py", line 92, in prepare_package
    for_appversions)
  File "/Users/bclark/src/mozilla/amo-validator/validator/submain.py", line 160, in test_package
    output = test_inner_package(err, package, for_appversions)
  File "/Users/bclark/src/mozilla/amo-validator/validator/submain.py", line 338, in test_inner_package
    test_func(err, xpi_package)
  File "/Users/bclark/src/mozilla/amo-validator/validator/testcases/jetpack.py", line 177, in inspect_jetpack
    blob_hash = hashlib.sha256(xpi_package.read(zip_path)).hexdigest()
  File "/Users/bclark/src/mozilla/amo-validator/validator/xpi.py", line 67, in read
    data = self.zf.read(filename)
  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/zipfile.py", line 869, in read
    return self.open(name, "r", pwd).read()
  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/zipfile.py", line 892, in open
    zinfo = self.getinfo(name)
  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/zipfile.py", line 859, in getinfo
    'There is no item named %r in the archive' % name)
KeyError: "There is no item named u'resources/searchspot/geolocation' in the archive"


And here's my untested fix (diff format):

diff --git a/validator/testcases/jetpack.py b/validator/testcases/jetpack.py
index f929553..a4b02ba 100644
--- a/validator/testcases/jetpack.py
+++ b/validator/testcases/jetpack.py
@@ -172,7 +172,7 @@ def inspect_jetpack(err, xpi_package, allow_old_sdk=False):
         # Strip off the resource:// if it exists
         if uri.startswith("resource://"):
             uri = uri[11:]
-        zip_path = "resources/%s" % uri.replace("@", "-at-")
+        zip_path = "resources/%s/%s/%s.js" % (module['packageName'], module['sectionName'], module['moduleName'].replace("@", "-at-"))
 
         blob_hash = hashlib.sha256(xpi_package.read(zip_path)).hexdigest()
         file_hashes[zip_path] = blob_hash
(In reply to Bryan Clark [:clarkbw] from comment #0)
>     'There is no item named %r in the archive' % name)
> KeyError: "There is no item named u'resources/searchspot/geolocation' in the
> archive"

Just to note that I do have a file called 'geolocation.js' and it's in the 'resources/searchspot/lib/' directory so 'resources/searchspot/lib/geolocation.js' works.
Sounds like a problem in the zip file index. Have you tried building the file in a different way?
Never mind, I see you already identified the problem.
Assignee: nobody → mattbasta
Target Milestone: --- → 2013-06-13
Just additional details.  My add-on was built with the `cfx xpi` command from the release branch of the addon-sdk.

1.14
ad58ee0e01d0b7e00a5baa4717262fa35a9e2ecf
Hi,

i cant upload my Addon-update too, but i dont see any errors in my document. Is this a problem with the validator? I got no errors if i test the Addon. 

Or do i just have to wait until something got fixed with in the validator?

Thx
Sio
You might be experiencing bug 880687 instead.
I know this bug was filed first, but whatevs.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.