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

Cannot set Custom field regex via API #9415

Closed
1 of 2 tasks
fabricat opened this issue Apr 8, 2021 · 2 comments
Closed
1 of 2 tasks

Cannot set Custom field regex via API #9415

fabricat opened this issue Apr 8, 2021 · 2 comments
Assignees
Labels
✋ bug Confirmed bug 👩‍💻 ready for dev These issues are ready for someone to work on them - take your pick!

Comments

@fabricat
Copy link

fabricat commented Apr 8, 2021

Please confirm you have done the following before posting your bug report:

Describe the bug
When I use API to create a new custom field with regex validation, I get the error "format":["The selected format is invalid."].

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://snipe-it.readme.io/reference#fields-2
  2. Fill the BODY PARAMS with:
    name="Regex test"
    element="text"
    format="regex:/^[0-9]{8}$/"
  3. Check on the right panel, the cURL command should end like this:
    --data {"show_in_email":false,"field_encrypted":false,"element":"text","name":"Regex test","format":"regex:/^[0-9]{8}$/"}
  4. Click on the Try It button
  5. See error message (relative to the format field):
    "The selected format is invalid"

The same happens on my local Docker installation (image snipe/snipe-it:v5.1.4).

Expected behavior
The custom field should be correctly created.

Screenshots
api-curl-error

Server (please complete the following information):

  • Snipe-IT Version 5.1.4
  • OS: Docker official image
  • Web Server: Docker official image
  • PHP Version: Docker official image

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Chrome
  • Version 87

Smartphone (please complete the following information):
n/a

Error Messages
The cURL output is:
{"status":"error","messages":{"format":["The selected format is invalid."]},"payload":null}

Additional context

  • Fresh install
  • Installed via Docker
@welcome
Copy link

welcome bot commented Apr 8, 2021

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@viclou
Copy link
Collaborator

viclou commented Apr 15, 2021

FD20573

@snipe snipe added ✋ bug Confirmed bug 👩‍💻 ready for dev These issues are ready for someone to work on them - take your pick! labels Apr 15, 2021
@inietov inietov closed this as completed Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✋ bug Confirmed bug 👩‍💻 ready for dev These issues are ready for someone to work on them - take your pick!
Projects
None yet
Development

No branches or pull requests

4 participants