MCPcopy Index your code
hub / github.com/parse-community/parse-server / validateFileUploadOptions

Method validateFileUploadOptions

src/Config.js:555–597  ·  view source on GitHub ↗
(fileUpload)

Source from the content-addressed store, hash-verified

553 }
554
555 static validateFileUploadOptions(fileUpload) {
556 try {
557 if (fileUpload == null || typeof fileUpload !== 'object' || Array.isArray(fileUpload)) {
558 throw 'fileUpload must be an object value.';
559 }
560 } catch (e) {
561 if (e instanceof ReferenceError) {
562 return;
563 }
564 throw e;
565 }
566 if (fileUpload.enableForAnonymousUser === undefined) {
567 fileUpload.enableForAnonymousUser = FileUploadOptions.enableForAnonymousUser.default;
568 } else if (typeof fileUpload.enableForAnonymousUser !== 'boolean') {
569 throw 'fileUpload.enableForAnonymousUser must be a boolean value.';
570 }
571 if (fileUpload.enableForPublic === undefined) {
572 fileUpload.enableForPublic = FileUploadOptions.enableForPublic.default;
573 } else if (typeof fileUpload.enableForPublic !== 'boolean') {
574 throw 'fileUpload.enableForPublic must be a boolean value.';
575 }
576 if (fileUpload.enableForAuthenticatedUser === undefined) {
577 fileUpload.enableForAuthenticatedUser = FileUploadOptions.enableForAuthenticatedUser.default;
578 } else if (typeof fileUpload.enableForAuthenticatedUser !== 'boolean') {
579 throw 'fileUpload.enableForAuthenticatedUser must be a boolean value.';
580 }
581 if (fileUpload.fileExtensions === undefined) {
582 fileUpload.fileExtensions = FileUploadOptions.fileExtensions.default;
583 } else if (!Array.isArray(fileUpload.fileExtensions)) {
584 throw 'fileUpload.fileExtensions must be an array.';
585 }
586 if (fileUpload.allowedFileUrlDomains === undefined) {
587 fileUpload.allowedFileUrlDomains = FileUploadOptions.allowedFileUrlDomains.default;
588 } else if (!Array.isArray(fileUpload.allowedFileUrlDomains)) {
589 throw 'fileUpload.allowedFileUrlDomains must be an array.';
590 } else {
591 for (const domain of fileUpload.allowedFileUrlDomains) {
592 if (typeof domain !== 'string' || domain === '') {
593 throw 'fileUpload.allowedFileUrlDomains must contain only non-empty strings.';
594 }
595 }
596 }
597 }
598
599 static validateFileDownloadOptions(fileDownload) {
600 try {

Callers 1

validateOptionsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected