neilenns / node-deepstackai-trigger

Detects motion using Deepstack AI and calls registered triggers based on trigger rules.
MIT License
165 stars 28 forks source link

Fix uri encoding #385

Closed TonyBrobston closed 3 years ago

TonyBrobston commented 3 years ago

Fixes https://github.com/danecreekphotography/node-deepstackai-trigger/issues/371

Description of changes

When I have a secret with a uri in it, it has problems. Here is what the log shows:

trigger_1 | 2020-10-27T10:16:49-05:00 [Trigger House East Cat/Dog detector] Error: Failed to call DeepStack at http://deepstack-ai:5000/: Error: Invalid URI "http:///&/v1/vision/detection"

I wrote a test that I think identifies the issue. However I may be wrong. Essentially http://127.0.0.1:5000/ becomes http://127.0.0.1:5000/ and that seems to be a problem. I'm not sure why this would be a problem.

On a side note, when my secret is a username or password it seems to work fine; also note my usernames and passwords do not have special characters in it.

Checklist

neilenns commented 3 years ago

I've had sooooo many problems with URL encoding, particularly if it's about encoding in the host name vs. in the path/query parameters :(

TonyBrobston commented 3 years ago

@danecreekphotography I didn't add a fix yet, just wrote a test that may or may not be valid. Sorry I should have made this more clear. Shouldn't effect anything negatively, so not much harm in the merge.

I'll look more into a fix over the next few days. Seems like there shouldn't be a problem, so I'll start reading on the subject.

neilenns commented 3 years ago

Yeah, it's fine. I knew it was just the test and merged it so there isn't a PR hanging around. Just open another PR when you have a fix.