Skip to content

Commit 26b5296

Browse files
rsofferflovilmart
authored andcommitted
Pass options through to RESTController from saveBase64 (#386)
1 parent 223d7aa commit 26b5296

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/ParseFile.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,18 +161,18 @@ export default class ParseFile {
161161
* @param {Object} options A Backbone-style options object.
162162
* @return {Parse.Promise} Promise that is resolved when the save finishes.
163163
*/
164-
save(options?: { success?: any, error?: any }) {
164+
save(options?: { useMasterKey?: boolean, success?: any, error?: any }) {
165165
options = options || {};
166166
var controller = CoreManager.getFileController();
167167
if (!this._previousSave) {
168168
if (this._source.format === 'file') {
169-
this._previousSave = controller.saveFile(this._name, this._source).then((res) => {
169+
this._previousSave = controller.saveFile(this._name, this._source, options).then((res) => {
170170
this._name = res.name;
171171
this._url = res.url;
172172
return this;
173173
});
174174
} else {
175-
this._previousSave = controller.saveBase64(this._name, this._source).then((res) => {
175+
this._previousSave = controller.saveBase64(this._name, this._source, options).then((res) => {
176176
this._name = res.name;
177177
this._url = res.url;
178178
return this;
@@ -256,7 +256,7 @@ var DefaultController = {
256256
return CoreManager.getRESTController().ajax('POST', url, source.file, headers);
257257
},
258258

259-
saveBase64: function(name: string, source: FileSource) {
259+
saveBase64: function(name: string, source: FileSource, options?: { useMasterKey?: boolean, success?: any, error?: any }) {
260260
if (source.format !== 'base64') {
261261
throw new Error('saveBase64 can only be used with Base64-type sources.');
262262
}
@@ -267,7 +267,7 @@ var DefaultController = {
267267
data._ContentType = source.type;
268268
}
269269
var path = 'files/' + name;
270-
return CoreManager.getRESTController().request('POST', path, data);
270+
return CoreManager.getRESTController().request('POST', path, data, options);
271271
}
272272
};
273273

0 commit comments

Comments
 (0)