Skip to content

Commit

Permalink
Fix embedAsBase64 blocking default endpoint upload
Browse files Browse the repository at this point in the history
  • Loading branch information
david-polak committed Feb 7, 2019
1 parent 9118ff3 commit eaa9f65
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/asset_manager/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ module.exports = {
// }
uploadFile: '',

// In the absence of uploadFile function assets will be embedded as Base64
// In the absence of 'uploadFile' or 'upload' assets will be embedded as Base64
embedAsBase64: 1,

// Handle the image url submit from the built-in 'Add image' form
Expand Down
11 changes: 5 additions & 6 deletions src/asset_manager/view/FileUploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = Backbone.View.extend(

if (uploadFile) {
this.uploadFile = uploadFile.bind(this);
} else if (c.embedAsBase64) {
} else if (!c.upload && c.embedAsBase64) {
this.uploadFile = this.constructor.embedAsBase64;
}

Expand Down Expand Up @@ -137,11 +137,10 @@ module.exports = Backbone.View.extend(
headers,
body
})
.then(
res =>
((res.status / 200) | 0) == 1
? res.text()
: res.text().then(text => Promise.reject(text))
.then(res =>
((res.status / 200) | 0) == 1
? res.text()
: res.text().then(text => Promise.reject(text))
)
.then(text => this.onUploadResponse(text, clb))
.catch(err => this.onUploadError(err));
Expand Down

0 comments on commit eaa9f65

Please sign in to comment.