File upload from within a view doesn't always show finished uploading

Bug #623648 reported by Kristina Hoeppner on 2010-08-24
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Medium
Ruslan Kabalin

Bug Description

When I re-upload an HTML file from within a view with the same name, it is not always shown as being uploaded, but the wheel continues to turn. However, the file is uploaded, because when I click Save and return to the settings, I can see the file with the new name.

In a couple of occasions, the file was shown immediately, but in 5 out of 8 it wasn't.

(master.dev, Firefox 3.6, Mac 10.6)

tags: added: files
Changed in mahara:
status: New → Triaged
Ruslan Kabalin (rkabalin) wrote :

I manage to replicate this one, FileBrowser.success (htdocs/artefact/file/js/filebrowser.js) function, which is used as callback, did not process errors properly.

Changed in mahara:
assignee: nobody → Ruslan Kabalin (ruslan-kabalin)
Changed in mahara:
status: Triaged → Fix Committed
Changed in mahara:
importance: Undecided → Medium
status: Fix Committed → In Progress
Ruslan Kabalin (rkabalin) wrote :

My commit 37ee9438 only does the part of the job towards this bug solving. The problem is really weird and yet I have not found the reason. The bug is applicable to filebrowser element that have "select" feature enabled (blog posts, "Some HTML" block within the view) and javascript is enabled.

To replicate the bug one should do the following steps:
1. Open "My Blog" and create new post (or edit existing one).
2. Click "Add the file" button.
3. Select the file to upload, it should finish successfully.
3a. (optional) You may upload another file or select file(s) from the list of existing files below.
4. Click "Remove" near any file in attachments.
5. Try to upload another file - uploading will never finish.

In fact the sequence above is not strict to replicate the bug, the problem occurs only if you are trying to upload the file (upload_submit function in filebrowser.js) right after removing any single file (unselect function in filebrowser.js). If you upload a file after any other event (say, you may Remove one file, then Select another one, then upload), upload will finish smoothly.

Investigation showed that this is not related to callback processing , as form is simply not submitted (data does not reach php side). I think it is something related to javascript signal processing. Say, adding a submit button, that calls the same self.upload_submit as file element does (and removing this event connector from file element) will solve the problem, but we do not need an extra button, do we?

Ironically, if you apply the attached patch, and click on the "Submit helper" button at the time when uploading got stuck, uploading will finish successfully.

I have search forums for similar problems, no luck so far.

The problem occurs in both IE and FF, on both 1.3 and master.

Any ideas?

Changed in mahara:
assignee: Ruslan Kabalin (ruslan-kabalin) → nobody
Ruslan Kabalin (rkabalin) wrote :

Of course the attached patch is not a solution and designed purely to demonstrate that initiating a submit event helps the previous unfinished (or uncalled) self.form.submit(); function to work out.

Ruslan,

Yeah, this is a really weird bug, I just tried it myself and I can't work it out either. It's as if clicking the unselect button does something that messes up the form in such a way that FF refuses to submit it.

Strangely for me, it only happens in FF, and works in IE/Chrome, though I didn't try it with your step 3a.

Ruslan Kabalin (rkabalin) wrote :

> It's as if clicking the unselect button does something that messes up the form in such a way that FF refuses to submit it.

It looks like, though I did not figure out what. It is like a Unselect submit event hangs in browser, and does not let the consequent event to work out.

>Strangely for me, it only happens in FF, and works in IE/Chrome,

For some reason I was sure I saw the same problem in IE, but having tried again I found that it works fine in IE. Sorry for misleading. It looks like the bug only happens in FF.

Ruslan,

I was working on a feature recently that would allow a user to choose a video encoding format in the upload form, and so I needed a way to turn off the automatic uploading of the file as soon as it's chosen, and include a submit button (like your submit-helper) instead.

I had to do this for the video thing because otherwise the form might be submitted before the user had a chance to choose the encoding format.

It's looking like that video encoding stuff won't make into the core code now, but I extracted the patch that lets you turn off the automatic submit-on-choose and replace it with the "submit helper".

Have a look and let me know what you think - we could use this as a workaround until we find a better way to fix the problem, but unfortunately it would spoil things a bit for the IE & Chrome users.

Actually a better workaround for chrome/ie users would be to detect firefox in the js, and hide/remove the upload form for FF on the first click of an unselect button after at least one successful upload.

Ruslan Kabalin (rkabalin) wrote :

Richard, your patch looks great to me, nice workaround. I have added browser check as you suggested (apply my patch on top of yours). Now it works properly in IE (did not test in Chrome though).

Ruslan, cool. I applied your browser check but at the same time retained the option for individual pages to specify that the submit button must be there (in case we get forms like the video encoding thing with more inputs than just the copyright agreement & file selector).

Changed in mahara:
status: In Progress → Fix Committed
milestone: none → 1.4.0
Changed in mahara:
assignee: nobody → Ruslan Kabalin (ruslan-kabalin)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers