validateUploadFileArgs method

  1. @override
void validateUploadFileArgs(
  1. FrappeUploadFileParams uploadFileParams
)
override

Validate the arguments of the file to be uploaded.

The method is silent, so it should throw errors in case there's a validation error.

Throws MissingFileError in case the file is null within uploadFileParams.

Throws MissingFileNameError in case the fileName is null or empty.

Implementation

@override
void validateUploadFileArgs(FrappeUploadFileParams uploadFileParams) {
  if (uploadFileParams.file == null) throw MissingFileError();

  if (uploadFileParams.fileName == null ||
      uploadFileParams.fileName!.isEmpty) {
    throw MissingFileNameError();
  }

  if (uploadFileParams.doctype != null && uploadFileParams.docname != null) {
    uploadFileParams.folder = null;
  }
}