https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292013-10-30T13:10:16ZRedmineRedmine - Defect #14953: Intermittent AJAX Atttachement Upload Failure in Firefoxhttps://www.redmine.org/issues/14953?journal_id=528712013-10-30T13:10:16ZCharlie Beckett
<ul></ul><p>Is there any easy way to more to fallback to the none ajax method whilst I investigate ?</p> Redmine - Defect #14953: Intermittent AJAX Atttachement Upload Failure in Firefoxhttps://www.redmine.org/issues/14953?journal_id=530142013-11-08T12:40:02ZThomas Löber
<ul></ul><p>Hi Charlie,</p>
<p>I have also experienced upload failures when there was too much time between two uploads.</p>
<p>The problem seems to be that the AJAX POST request (in contrast to GET) doesn't try to re-authenticate when the connection to the server was closed after some time of inactivity.</p>
<p>However I was able to build a workaround by issuing an AJAX GET request in case of failure and then try the upload (POST) again:</p>
<pre>
--- public/javascripts/attachments.js.orig
+++ public/javascripts/attachments.js
@@ -53,6 +53,12 @@
fileSpan.find('input.description, a').css('display', 'inline-block');
})
.fail(function(result) {
+ if (result.status == 0 && result.statusText == "error") {
+ var url = $(inputEl).data("upload-path").replace(/^\/([^/]+).*/, "/$1/authenticate.txt");
+ $.ajax({url: url, cache: false}).
+ done(function() { actualUpload(file, attachmentId, fileSpan, inputEl); });
+ return;
+ }
progressSpan.text(result.statusText);
}).always(function() {
ajaxUpload.uploading--;
</pre>
<p>You will have to create an empty file <code>authenticate.txt</code> in <code>public</code> for this to work.</p>
<p>Best regards,<br />Thomas</p> Redmine - Defect #14953: Intermittent AJAX Atttachement Upload Failure in Firefoxhttps://www.redmine.org/issues/14953?journal_id=530152013-11-08T12:50:29ZThomas Löber
<ul></ul><p>I have just seen that the regexp above handles the Rails URL prefix. If you do not use this feature you may use "/authenticate.txt" directly:</p>
<pre>
var url = "/authenticate.txt";
</pre> Redmine - Defect #14953: Intermittent AJAX Atttachement Upload Failure in Firefoxhttps://www.redmine.org/issues/14953?journal_id=530652013-11-11T14:46:40ZCharlie Beckett
<ul></ul><p>Hi Thomas<br />Thanks for helping with this. This seems to work really well in IE, but now the file doesn't upload in Firefox and Chrome reports "Not Acceptable" after several tries.</p> Redmine - Defect #14953: Intermittent AJAX Atttachement Upload Failure in Firefoxhttps://www.redmine.org/issues/14953?journal_id=536082013-12-05T13:40:39ZD G
<ul></ul><p>Same problem here. Redmine 2.4.1 + Kerberos. Until this error is fixed we use included fallback form submission:<br /><pre><code class="diff syntaxhl"><span class="gd">--- public/javascripts/attachments.js (revision 12347)
</span><span class="gi">+++ public/javascripts/attachments.js (working copy)
</span><span class="p">@@ -117,19 +117,12 @@</span>
function addInputFiles(inputEl) {
var clearedFileInput = $(inputEl).clone().val('');
- if (inputEl.files) {
<span class="gd">- // upload files using ajax
- uploadAndAttachFiles(inputEl.files, inputEl);
- $(inputEl).remove();
- } else {
- // browser not supporting the file API, upload on form submission
</span> var attachmentId;
var aFilename = inputEl.value.split(/\/|\\/);
attachmentId = addFile(inputEl, { name: aFilename[ aFilename.length - 1 ] }, false);
if (attachmentId) {
$(inputEl).attr({ name: 'attachments[' + attachmentId + '][file]', style: 'display:none;' }).appendTo('#attachments_' + attachmentId);
}
<span class="gd">- }
</span>
clearedFileInput.insertAfter('#attachments_fields');
}
</code></pre></p> Redmine - Defect #14953: Intermittent AJAX Atttachement Upload Failure in Firefoxhttps://www.redmine.org/issues/14953?journal_id=579552014-08-08T17:53:31ZEbrahim Mohammadi
<ul></ul><p>Related: <a class="issue tracker-1 status-1 priority-4 priority-default" title="Defect: Large uploads fails with Firefox (New)" href="https://www.redmine.org/issues/6089">#6089</a></p> Redmine - Defect #14953: Intermittent AJAX Atttachement Upload Failure in Firefoxhttps://www.redmine.org/issues/14953?journal_id=584612014-09-07T04:53:16ZToshi MARUYAMA
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-1 priority-4 priority-default" href="/issues/6089">Defect #6089</a>: Large uploads fails with Firefox</i> added</li></ul>