Skip to content

Commit 7f1ad74

Browse files
committed
Issues-338: configure the editor if no upload permissions
1 parent fc6d578 commit 7f1ad74

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

js/topcodereditor.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,13 @@
235235
if (this.status === 201 && response && !response.error && response.mediaID > 0 && response.size > 0) {
236236
onSuccess(response);
237237
} else {
238-
if (response.errors) { // server side generated error message
238+
if (response.errors || response.message) { // server side generated error message
239239
onErrorSup(parseServerErrors(response));
240-
} else { //unknown error
241-
console.error('EasyMDE: Received an unexpected response after uploading the image.'
242-
+ this.status + ' (' + this.statusText + ')');
243-
onErrorSup(fillErrorMessage(self.options.errorMessages.importError));
240+
} else {
241+
//unknown error
242+
console.error('EasyMDE: Received an unexpected response after uploading the image.'
243+
+ this.status + ' (' + this.statusText + ')');
244+
onErrorSup(fillErrorMessage(self.options.errorMessages.importError));
244245
}
245246
}
246247
};
@@ -557,7 +558,7 @@
557558
sbOnUploaded: 'Uploaded #image_name#',
558559
sizeUnits: ' B, KB, MB',
559560
},
560-
uploadImage: true,
561+
uploadImage: canUpload,
561562
imageMaxSize: maxUploadSize, //Maximum image size in bytes
562563
imageAccept: allowedFileMimeTypeWithExts, //A comma-separated list of mime-types and extensions
563564
imageUploadFunction: customUploadImage,

0 commit comments

Comments
 (0)