Encoding error in JSON error message when uploading invalid xpi

VERIFIED FIXED in 5.0.9

Status

addons.mozilla.org Graveyard
Developer Pages
--
major
VERIFIED FIXED
9 years ago
2 years ago

People

(Reporter: Joachim Herb, Assigned: wenzel)

Tracking

unspecified
5.0.9

Details

Attachments

(5 attachments)

(Reporter)

Description

9 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.9.1) Gecko/20090624 Firefox/3.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.9.1) Gecko/20090624 Firefox/3.5

I tried to upload an extension (getpartialmessages-0.1.xpi). I guess the frist trail somehow did not work. When I try to upload the same file, I get an error message:
This add-on-ID already exists...

So I renamed the file to getpartialmessages-0.1.1.xpi and tried to upload again:


Hoppla! Mit dieser Datei scheint es ein Problem zu geben...

Diese Add-on-ID ({2d19fa6f-da0b-4677-b73f-53934866de8a}) existiert bereits in der Datenbank. Falls dies Ihr Add-on ist, möchten Sie wahrscheinlich eine neue Version hochladen.

Bitte beheben Sie dieses Problem und laden Sie Ihre Datei erneut hoch.

(sorry for the German version. I were not able to get an English error message. By the way there seems to be a problem with the encoding)

Now I tried tied the update link ("neue Version"). This resulted in this error message (access denied):

Zugriff verweigert

Sie haben nicht die erforderlichen Berechtigungen, um diese Seite angezeigt zu bekommen.


Reproducible: Always
(Reporter)

Comment 1

9 years ago
Created attachment 389198 [details]
This is the add-on I try to upload.
(Assignee)

Comment 2

9 years ago
We've seen this kind of error a few times now. It seems, when an add-on is broken a specific way, it gets created yet the author does not get any access rights to it. This is a bug in the Dev CP and we should figure out where it occurs, so an add-on is either not created or if it is, the author can access it properly in spite of the error.

Naturally, we also need to help Herb with his particular add-on.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows Vista → All
Hardware: x86 → All

Comment 3

9 years ago
There are several related problems.

Your install.rdf contains <em:homepageURL> elements twice.  From some experimenting, I am sure that that is the reason your first attempt failed; or more precisely, half-succeeded and half-failed.  That is worse than a complete failure because now the ID of your extension has been registered on addons.mozilla.org but you cannot access it.  This is the reason the subsequent attempts failed.  Because of this, you will not probably be able to upload it even after you remove the second <em:homepageURL> element from your install.rdf.

The easiest workaround that I can think of is to change an ID.  Make sure you change all the occurrences of the ID, not only in install.rdf.

Comment 4

9 years ago
Just to make sure, “ID” in my comment 3 refers to the add-on ID, which is {2d19fa6f-da0b-4677-b73f-53934866de8a} in your case.

Comment 5

9 years ago
(In reply to comment #3)
> The easiest workaround that I can think of is to change an ID.  Make sure you
> change all the occurrences of the ID, not only in install.rdf.

This might not be a good idea if you have already been distributing this add-on somewhere else, because existing users cannot update the add-on easily if you change the add-on ID.

Comment 6

9 years ago
(In reply to comment #2)
> Naturally, we also need to help Herb with his particular add-on.
I agree.

(In reply to comment #3)
> Your install.rdf contains <em:homepageURL> elements twice.  From some
> experimenting, I am sure that that is the reason your first attempt failed;
It seems that this was caused not by having two <em:homepageURL> elements, but by having an empty <em:homepageURL> element.
(Reporter)

Comment 7

9 years ago
(In reply to comment #6)
> (In reply to comment #3)
> > Your install.rdf contains <em:homepageURL> elements twice.  From some
> > experimenting, I am sure that that is the reason your first attempt failed;
> It seems that this was caused not by having two <em:homepageURL> elements, but
> by having an empty <em:homepageURL> element.
Thank you for your help: I removed the empty <em:homepageURL> element and now it worked. 

So it works for me.

Nevertheless an error message would have been helpful. Even if it only stated that the install.rdf contains invalid information.

(And just a reminder about the encoding problem of the original error message.)
(Assignee)

Comment 8

9 years ago
Did you change the ID? Otherwise I can probably indeed give you access to the other, orphaned add-on.
(Assignee)

Comment 9

9 years ago
(In reply to comment #7)
> Nevertheless an error message would have been helpful. Even if it only stated
> that the install.rdf contains invalid information.

Absolutely, that is what's usually supposed to happen, but apparently in this case it doesn't.

> (And just a reminder about the encoding problem of the original error message.)

I cannot confirm the encoding issue here: Our page is completely UTF-8, and the string seems to be fine. Have you set up your browser to enforce ISO8859-1 encoding?
(Reporter)

Comment 10

9 years ago
(In reply to comment #8)
> Did you change the ID? Otherwise I can probably indeed give you access to the
> other, orphaned add-on.

I did change the ID.

(In reply to comment #9)
> I cannot confirm the encoding issue here: Our page is completely UTF-8, and 
> the string seems to be fine. Have you set up your browser to enforce 
> ISO8859-1 encoding?

I tried to upload the same version of the addon again, to reproduce the encoding error and I got the same result. I will add an attachment with a screenshot. Below is the source code of the relevant part of the page. As you can see only the text in the box seems to use the wrong encoding. I tested the upload with Firefox 3.5.1/Windows Vista and Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.0.11) Gecko/2009062818 Gentoo Firefox/3.0.11 - Build ID: 2009062818



<div id="file-upload">
            <h3>Datei hochladen</h3>
            <p>Laden Sie die Datei für Ihr Add-on mit dem unten stehenden Formular hoch. Falls Sie mehrere, plattform-spezifische Dateien haben, wählen Sie zunächst eine der Dateien und laden Sie die übrigen auf der "Versionen und Dateien"-Seite hoch.            <br>
            </p><form id="upload-form" method="post" enctype="multipart/form-data" action="/de/developers/json/fileupload/update" target="upload-frame" onsubmit="return upload.uploadFile();">
            <div class="hsession"><input name="sessionCheck" value="7cf86da3a4d4f90b27ab77d82c82480d" type="hidden"></div>            <input name="data[Addon][id]" value="13131" type="hidden">                        <label>Add-on-Datei: <input id="upload-field" name="file" type="file"></label><br>
        Unterstützte Betriebssysteme:&nbsp;&nbsp;<label><input name="platformtype" onclick="upload.platformAll();" checked="checked" type="radio">&nbsp;Alle</label>&nbsp;&nbsp;

            <label><input name="platformtype" onclick="upload.platformSpecific();" type="radio">&nbsp;Spezifisch:</label>
            &nbsp;&nbsp;<label class="specific-platforms disabled"><input name="data[File][platform_id][]" value="4" disabled="disabled" type="checkbox">BSD</label>&nbsp;&nbsp;<label class="specific-platforms disabled"><input name="data[File][platform_id][]" value="2" disabled="disabled" type="checkbox">Linux</label>&nbsp;&nbsp;<label class="specific-platforms disabled"><input name="data[File][platform_id][]" value="3" disabled="disabled" type="checkbox">MacOSX</label>&nbsp;&nbsp;<label class="specific-platforms disabled"><input name="data[File][platform_id][]" value="6" disabled="disabled" type="checkbox">Solaris</label>&nbsp;&nbsp;<label class="specific-platforms disabled"><input name="data[File][platform_id][]" value="5" disabled="disabled" type="checkbox">Windows</label>            <div class="submit">
                <input value="Datei hochladen" class="require-privs" type="submit">
            </div>
            <div style="display: none;" id="upload-loading"><img src="/img/ajax_loading.gif">&nbsp;Datei wird hochgeladen...</div>

            </form>
            <div style="display: block;" id="upload-error" class="redbox-tr"><div class="redbox-tl">
                <div id="upload-error-content">
                    <h4>Hoppla! Mit dieser Datei scheint es ein Problem zu geben...</h4>
                    <p id="upload-error-text" class="smallmargin">Die hochgeladene Version (0.1.2) existiert bereits für dieses Add-on. Wenn Sie eine weitere Datei zu dieser Version hinzufügen möchten, <a href="/de/firefox/developers/versions/addfile/73756">klicken Sie hier</a>.</p>
                    <p class="smallmargin">Bitte beheben Sie dieses Problem und laden Sie Ihre Datei erneut hoch.</p>

                </div>
                <div class="redbox-br"><div class="redbox-bl"></div></div>
            </div></div>
        </div>
(Reporter)

Comment 11

9 years ago
Created attachment 389287 [details]
Screenshot with encoding error in error message.
(Reporter)

Comment 12

9 years ago
Created attachment 389535 [details]
Another error message with wrong encoding.
I'm assigning this to Fred just to figure out the encoding problems.  If that's something only in production, we can file an IT bug.  If it's on herb's machine we can wontfix, or if there is something we can do he can fix it.

The error messages are another bug (should be rolled into our add-on parser) and don't block closing this bug.
Assignee: nobody → fwenzel
Target Milestone: --- → 5.0.9

Updated

9 years ago
Priority: -- → P2
(Assignee)

Comment 14

9 years ago
I have a patch ready for this, using json_encode() to encode our JSON properly and not screw up utf-8 anymore. This requires PHP 5.2.0 or later.
Blocks: 506703
(Assignee)

Updated

9 years ago
Priority: P2 → --
Summary: Cannot upload / update an addon → Encoding error in JSON error message when uploading invalid xpi
(Assignee)

Updated

9 years ago
Duplicate of this bug: 508735
(Assignee)

Comment 16

9 years ago
Created attachment 392896 [details] [diff] [review]
Patch, rev. 1

This fixes the JSON encoding and it requires PHP 5.2.0. To test, upload a broken .xpi (invalid install.rdf will do the trick) in, for example, German, French or Japanese and note the non-ASCII characters not being screwed up.
(Assignee)

Updated

9 years ago
Status: NEW → ASSIGNED
Comment on attachment 392896 [details] [diff] [review]
Patch, rev. 1

>-    upload.response = JSON.parse(document.getElementById('upload-frame').contentWindow.document.getElementById('json').innerHTML);
>+    upload.response = JSON.parse($('#upload-frame').contents().find('#json').text());

The response often includes HTML, like links.
(Assignee)

Updated

9 years ago
Attachment #392896 - Flags: review?(clouserw)
(Assignee)

Comment 18

9 years ago
(In reply to comment #17)
> (From update of attachment 392896 [details] [diff] [review])
> >-    upload.response = JSON.parse(document.getElementById('upload-frame').contentWindow.document.getElementById('json').innerHTML);
> >+    upload.response = JSON.parse($('#upload-frame').contents().find('#json').text());
> 
> The response often includes HTML, like links.

That should be fine, considering the HTML is wrapped inside a JSON object (I am treating the entire object as plain text here).

Actually using the html content (as html) happens a few lines later:
-        $('#upload-error-text').html(urldecode(upload.response.error_message));
+        $('#upload-error-text').html(upload.response.error_message);
(Reporter)

Comment 19

9 years ago
I don't know why, but I tried to add another addon and the original problem happened again. After the upload could not add an project description.

I do not see the addon in my list. When I tried to upload the file again, I got an errormessage, that the version already exists and I should add a new version with this link:
https://addons.mozilla.org/de/firefox/developers/versions/add/13546
But there I get an error message saying that the access was denied.

Can somebody with the propper rights please reset this addon, so I can upload it again. If possible I would like to avail to change the addon id.

Here the error message:

Hoppla! Mit dieser Datei scheint es ein Problem zu geben...

Diese Add-on-ID (CompactHeader@mozilla.org) existiert bereits in der Datenbank. Falls dies Ihr Add-on ist, möchten Sie wahrscheinlich eine neue Version hochladen.

Bitte beheben Sie dieses Problem und laden Sie Ihre Datei erneut hoch.


Oops! There seems to be a problem with this file...

This add-on ID (CompactHeader@mozilla.org) already exists in the database. If this is your add-on, you can upload a new version.

Please correct this problem and upload your file again.

--
Access Denied

You are not authorized to view this page.
--
(Reporter)

Comment 20

9 years ago
Created attachment 393009 [details]
Addon cannot be uploaded.
Attachment #392896 - Flags: review?(clouserw) → review+
Let's not commit this until PHP is upgraded
No longer blocks: 506703
Depends on: 506703

Comment 22

9 years ago
(In reply to comment #19)
> Can somebody with the propper rights please reset this addon, so I can upload
> it again. If possible I would like to avail to change the addon id.

> This add-on ID (CompactHeader@mozilla.org) already exists in the database. If
> this is your add-on, you can upload a new version.

I do not know who are allowed to use add-on IDs with the mozilla.org domain.  Assuming that you are, and assuming that no one with the necessary permissions has responded yet, I suggest you to either
- ask on irc.mozilla.org (I am not sure which channel, but probably #amo, possibly #addons), or
- file a separate bug,
because this bug has been morphed specifically to deal with the problem with the encoding of the error message.
(Reporter)

Comment 23

9 years ago
I opened a new bug 509211 for the problem of uploading a broken install.rdf and the following blockage of the addon ID.
wenzel: PHP is upgraded on preview, let's land this.
(Assignee)

Comment 25

8 years ago
r49807
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
Keywords: push-needed
Resolution: --- → FIXED
Herb, is this something you could help us out with by verifying on https://preview.addons.mozilla.org?  Thanks!
(Reporter)

Comment 27

8 years ago
WFM
Verified FIXED per comment 27.
Status: RESOLVED → VERIFIED
Keywords: push-needed
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.