mirror of
				https://github.com/janeczku/calibre-web
				synced 2025-10-31 07:13:02 +00:00 
			
		
		
		
	Additional fix for #845 (in case of error)
This commit is contained in:
		| @@ -130,22 +130,19 @@ | |||||||
|             this.$modalFooter.show(); |             this.$modalFooter.show(); | ||||||
|  |  | ||||||
|             var contentType = xhr.getResponseHeader("Content-Type"); |             var contentType = xhr.getResponseHeader("Content-Type"); | ||||||
|             // Replace the contents of the form, with the returned html |  | ||||||
|             if (xhr.status === 422) { |  | ||||||
|                 var newHtml = $.parseHTML(xhr.responseText); |  | ||||||
|                 this.replaceForm(newHtml); |  | ||||||
|                 this.$modal.modal("hide"); |  | ||||||
|             } |  | ||||||
|             // Write the error response to the document. |             // Write the error response to the document. | ||||||
|             else{ |             if (contentType || xhr.status === 422) { | ||||||
|                 // Handle no response error |                 var responseText = xhr.responseText; | ||||||
|                 if (contentType) { |                 if (contentType.indexOf("text/plain") !== -1) { | ||||||
|                     var responseText = xhr.responseText; |                     responseText = "<pre>" + responseText + "</pre>"; | ||||||
|                     if (contentType.indexOf("text/plain") !== -1) { |  | ||||||
|                         responseText = "<pre>" + responseText + "</pre>"; |  | ||||||
|                     } |  | ||||||
|                     document.write(responseText); |                     document.write(responseText); | ||||||
|                 } |                 } | ||||||
|  |                 else { | ||||||
|  |                     this.$modalBar.text(responseText); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |             else { | ||||||
|  |                 this.$modalBar.text(this.options.modalTitleFailed); | ||||||
|             } |             } | ||||||
|         }, |         }, | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3778,8 +3778,7 @@ def upload(): | |||||||
|             try: |             try: | ||||||
|                 os.unlink(meta.file_path) |                 os.unlink(meta.file_path) | ||||||
|             except OSError: |             except OSError: | ||||||
|                 flash(_(u"Failed to delete file %(file)s (Permission denied).", file= meta.file_path), |                 return Response(_(u"Failed to delete file %(file)s (Permission denied).", file= meta.file_path)), 422 | ||||||
|                       category="warning") |  | ||||||
|  |  | ||||||
|             if meta.cover is None: |             if meta.cover is None: | ||||||
|                 has_cover = 0 |                 has_cover = 0 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Ozzieisaacs
					Ozzieisaacs