midjourney-api icon indicating copy to clipboard operation
midjourney-api copied to clipboard

Logical Error in `VerifyHuman` Constructor

Open JKamsker opened this issue 2 years ago • 0 comments

Describe the bug

Hello,

I've found a potential issue in the VerifyHuman class, specifically in its constructor. Currently, the constructor throws an error if the HuggingFaceToken is an empty string or if it exists. Here's the relevant code:

if (HuggingFaceToken === "" || HuggingFaceToken) {
  throw new Error("HuggingFaceToken is required");
}

However, I believe the intended behavior is to throw an error if HuggingFaceToken is an empty string or if it does not exist. The corrected code would look like this:

if (HuggingFaceToken === "" || !HuggingFaceToken) {
  throw new Error("HuggingFaceToken is required");
}

This change will ensure that an error is thrown when HuggingFaceToken is either an empty string or undefined, which seems to be the intended behavior.

Please let me know if you need any further information or clarification.

Best regards.

JKamsker avatar Sep 13 '23 23:09 JKamsker