Handle http 500 error on message send (#7959)

This commit is contained in:
johndoh
2021-04-09 07:25:38 +01:00
committed by GitHub
parent 2f42fa2eaf
commit 8453d147d7
2 changed files with 13 additions and 5 deletions

View File

@@ -48,7 +48,7 @@ class rcmail_output_html extends rcmail_output
protected $assets_path;
protected $assets_dir = RCUBE_INSTALL_PATH;
protected $devel_mode = false;
protected $default_template = "<html>\n<head><title></title></head>\n<body></body>\n</html>";
protected $default_template = "<html>\n<head><meta name='generator' content='Roundcube'><title></title></head>\n<body></body>\n</html>";
// deprecated names of templates used before 0.5
protected $deprecated_templates = [

View File

@@ -4029,7 +4029,7 @@ function rcube_webmail()
hidden = $("[name='_pgpmime']", form),
msgid = ref.set_busy(true, draft || saveonly ? 'savingmessage' : 'sendingmessage');
form.target = ref.get_save_target();
form.target = ref.get_save_target(msgid);
form._draft.value = draft ? '1' : '';
form.action = ref.add_url(form.action, '_unlock', msgid);
form.action = ref.add_url(form.action, '_framed', 1);
@@ -4828,7 +4828,7 @@ function rcube_webmail()
$('li', this.gui_objects.attachmentlist).each(function() { files.push(this.id.replace(/^rcmfile/, '')); });
$('[name="_attachments"]', form).val(files.join());
form.target = this.get_save_target();
form.target = this.get_save_target(msgid);
form._draft.value = draft ? '1' : '';
form.action = this.add_url(form.action, '_unlock', msgid);
form.action = this.add_url(form.action, '_framed', 1);
@@ -5211,11 +5211,19 @@ function rcube_webmail()
};
// Create (attach) 'savetarget' iframe before use
this.get_save_target = function()
this.get_save_target = function(unlock)
{
// Removing the frame on load/error to workaround issues with window history
this.dummy_iframe('savetarget', 'about:blank')
.on('load error', function() { $(this).remove(); });
.on('load error', function() {
// catch invalid/error response from server and unlock the UI (#7494, #7488, #7522)
if (unlock && $(this).contents().find('meta[name="generator"][content="Roundcube"]').length == 0) {
ref.iframe_loaded(unlock);
ref.display_message('connerror', 'error');
}
$(this).remove();
});
return 'savetarget';
};