Browse Source

Fix embedAsBase64 blocking default endpoint upload

pull/1773/head
David Polak 7 years ago
parent
commit
eaa9f654cd
  1. 2
      src/asset_manager/config/config.js
  2. 11
      src/asset_manager/view/FileUploader.js

2
src/asset_manager/config/config.js

@ -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

11
src/asset_manager/view/FileUploader.js

@ -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;
}
@ -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));

Loading…
Cancel
Save