Fix fileupload defaults not applied (#7086)

* added fileUpload definition default value

* added undefined and null as invalid

* removed explicit default value reference

* improved test grouping in describes
This commit is contained in:
Manuel
2021-01-11 21:26:56 +01:00
committed by GitHub
parent 1ede078154
commit e08618e377
4 changed files with 1112 additions and 1095 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -250,11 +250,15 @@ export class Config {
}
static validateFileUploadOptions(fileUpload) {
if (!fileUpload) {
fileUpload = {};
}
if (typeof fileUpload !== 'object' || fileUpload instanceof Array) {
throw 'fileUpload must be an object value.';
try {
if (fileUpload == null || typeof fileUpload !== 'object' || fileUpload instanceof Array) {
throw 'fileUpload must be an object value.';
}
} catch (e) {
if (e instanceof ReferenceError) {
return;
}
throw e;
}
if (fileUpload.enableForAnonymousUser === undefined) {
fileUpload.enableForAnonymousUser = FileUploadOptions.enableForAnonymousUser.default;

File diff suppressed because it is too large Load Diff

View File

@@ -199,7 +199,8 @@ export interface ParseServerOptions {
:DEFAULT: false */
idempotencyOptions: ?IdempotencyOptions;
/* Options for file uploads
:ENV: PARSE_SERVER_FILE_UPLOAD_OPTIONS */
:ENV: PARSE_SERVER_FILE_UPLOAD_OPTIONS
:DEFAULT: {} */
fileUpload: ?FileUploadOptions;
/* Full path to your GraphQL custom schema.graphql file */
graphQLSchema: ?string;