Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't create a "Send" via "bw serve" #9234

Closed
1 task done
berm-odoo opened this issue May 17, 2024 · 2 comments
Closed
1 task done

Can't create a "Send" via "bw serve" #9234

berm-odoo opened this issue May 17, 2024 · 2 comments
Labels

Comments

@berm-odoo
Copy link

Steps To Reproduce

Try to create a Send via an HTTP request while "bw serve" run using the template JSON send.text

Expected Result

A new "Send" is create

Actual Result

Failed because the date is not valid.

Screenshots or Videos

No response

Additional Context

I've tracked the issue to the related code.
The issue come from the if condition in the file clients/apps/cli/src/tools/send/commands/create.command.ts on line 53

    if (
      req.deletionDate == null ||   // return true if deletion date is null
      isNaN(new Date(req.deletionDate).getTime()) ||   // return true if deletion date is NaN
      new Date(req.deletionDate) <= new Date()    // return true if the date can be cast properly
    ) {
      return Response.badRequest("Must specify a valid deletion date after the current time");
    }

The first line of the condition return true if the deletion date is null, the second one return true if the deletion date equal NaN and the last one return true if the deletion date can be cast to a date object so the condition is always true.
Reverse the check on the last line to return true if the date can't be cast properly to a date object.

  !(new Date(req.deletionDate) <= new Date())   // return the good boolean

Operating System

Linux

Operating System Version

Arch

Shell

Zsh

Build Version

2024.4.1

Issue Tracking Info

  • I understand that work is tracked outside of Github. A PR will be linked to this issue should one be opened to address it, but Bitwarden doesn't use fields like "assigned", "milestone", or "project" to track progress.
@berm-odoo berm-odoo added bug cli CLI Application labels May 17, 2024
@cbbit
Copy link

cbbit commented May 17, 2024

Hi there,

Thank you for your report! I have flagged this to our engineering team.

If you wish to add any further information/screenshots/recordings etc., please feel free to do so at any time - our engineering team will be happy to review these.

Thanks once again!

@berm-odoo
Copy link
Author

Woops, my mistake sorry.
Not enough sleep and too much cafeine.
Sorry for wasting your time.

Have a good day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants