Skip to content

Instantly share code, notes, and snippets.

@af
Created June 28, 2012 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save af/3012614 to your computer and use it in GitHub Desktop.
Save af/3012614 to your computer and use it in GitHub Desktop.
Redactor image upload fix
--- a/public/js/artist_libs/redactor.js
+++ b/public/js/artist_libs/redactor.js
@@ -2993,7 +2993,10 @@ var RLANG = {
// Success
if (this.uploadOptions.success)
{
- this.uploadOptions.success(d.body.innerHTML);
+ // Remove bizarre <pre> tag wrappers around our json data:
+ var rawString = d.body.innerHTML;
+ var jsonString = rawString.match(/\{.*\}/)[0];
+ this.uploadOptions.success(jsonString);
}
this.element.attr('action', this.element_action);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment