DoESLiverpool / logcards

Basic RFID logging system used to control the doors and access to the space
http://wiki.doesliverpool.com/DoorBot
3 stars 0 forks source link

Unlogged visits parsing can cause issues #15

Open johnmckerrell opened 1 year ago

johnmckerrell commented 1 year ago

We had a problem where the unlogged visits file was malformed and this caused the script to go into a cycle of erroring out. We need to add more checks. Basically if we read the file in and it's not false we assume that it has an array of users, we should actually check if that's true. Also later we assume if there is a user it has the correct format, again we should check that, around here:

402:      if $unloggedFile['user'].count > 0

and here:

440:          uri = URI.parse("https://docs.g......

Not sure about those line numbers as they don't seem to match what I was seeing on the doorbot but they match the copy of log cards I have locally.

johnmckerrell commented 9 months ago

The bad file looks like this:

---
user:
  ! '': 6.5

I've fixed it now here https://github.com/DoESLiverpool/logcards/pull/12/commits/69e64f2fed89a7db661ee4693a1b5cc49d43f48a