snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

The mac address format is invalid.

Open itsluzby opened this issue 5 years ago • 9 comments

Hello firstly thanks for very nice and useful tool.

Why all of these formats are invalid?

01:02:03:04:ab:cd 01-02-03-04-ab-cd 01.02.03.04.ab.cd 0102:0304:abcd 0102-0304-abcd 0102.0304.abcd 01020304abcd

Browser: Chrome version 91.0.4472.114 (Official Build) (64-bit)

Same thing happen in official demo and in my fresh installation. Snipe-IT v5.1.6 build 6109 (gace7abc1a) PHP 7.4.3 Laravel 6.20.28

itsluzby avatar Jun 19 '21 10:06 itsluzby

👋 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.

welcome[bot] avatar Jun 19 '21 10:06 welcome[bot]

The first two should work. They both worked on demo https://develop.snipeitapp.com.

Make sure that you don't have a leading or trailing space when using the MAC address format.

boring10 avatar Jun 20 '21 11:06 boring10

As @boring10 noted, the first 2 forms in your examples does work. For the others... they are supported MAC addresses formats, but they aren't expressed in the example regex we provide. If you want them to be supported in your install, you should tweak the custom field's regex.

inietov avatar Jun 29 '21 17:06 inietov

@boring10 I have the same issue and I tried to test the demo site and got the same error. image

Here is the MAC I used to test: ‪B0:4G:13:05:83:1C

mutawa19 avatar Mar 06 '23 21:03 mutawa19

Hi there @mutawa19,

I don't think B0:4G:13:05:83:1C is a valid mac address since G is outside of the supported range right?

marcusmoore avatar Mar 06 '23 21:03 marcusmoore

@marcusmoore I did change few things because I didn't want to publicly list my MAC address. That G was one of the characters I changed. I did some farther testing and I think the issue was that I copied the MAC address from the text file exported from windows "System information" tool. For some reason, there is and invisible space before the B. Even though I tried to delete this leading space, which I couldn't see to delete anyway, doing so does nothing.

I wrote a Java code to compere the manually typed string vs the copied one. The code detects and invisible leading space for some reason. I still don't know why this is happening.

It would be nice if you the developers add a trim function to the code for this textbox so it can clean the leading spaces before sending this to the DB.

image

mutawa19 avatar Mar 06 '23 22:03 mutawa19

@mutawa19 Ah invisible characters are always fun 😅

Trimming input before storing is a valid request. I'm hesitant to open a PR that makes that change, even though it makes sense to me, due to the chances of it breaking someone's workflow somehow. The app doesn't use Laravel's TrimStrings and I have a feeling that is for a reason. But you're free to open a new issue so it can be discussed.

marcusmoore avatar Mar 07 '23 00:03 marcusmoore

@marcusmoore I am not familiar with the process here. In fact, I don't even think that trimming would solve the issue. I tried to print the length of the trimmed string in Java and it still gives me 18 characters when it should be only 17 (including the charAt(0)).

Opening the text file VS code editor reveals that there is a ‪[U+202A] before the MAC address I am trying to copy. I just thought I should mention this here incase someone has the same issue or maybe for the developers to try and truncate the string in this textbox. I don't know.

image

mutawa19 avatar Mar 07 '23 00:03 mutawa19

@mutawa19 no worries and thank you. I appreciate you sharing your process to help anyone in the future that might have the same issue! 😄

marcusmoore avatar Mar 07 '23 01:03 marcusmoore