Skip to content

Conversation

@markkuleinio
Copy link
Contributor

@markkuleinio markkuleinio commented Dec 17, 2020

Fixes #309 (that was caused by the parsing change in #308)

NetBox removes the default http/https (80 or 443 respectively) port from the response object URL even though it is given for any reason in the pynetbox.Api instantiation. That makes Record._endpoint_from_url() generate incorrect App names (it removes too many characters from the given URL) in those cases.

This PR makes Record._endpoint_from_url() to remove the default ports so that the App name is correctly parsed. Parsing does not look very elegant but works 😐

@markkuleinio
Copy link
Contributor Author

Or, should we just remove the default ports from the URL right in the pynetbox.Api instantiation and forget all this mangling in Record._endpoint_from_url()?

@zachmoody
Copy link
Contributor

Or, should we just remove the default ports from the URL right in the pynetbox.Api instantiation and forget all this mangling in Record._endpoint_from_url()?

Yeah, if we're going to take on sanitizing input, we should probably do it there. I can whip up a PR for it a bit later.

@markkuleinio
Copy link
Contributor Author

Ok, I'll close this (https://tools.ietf.org/html/rfc3986#section-3.2.3 was mentioned in #309).

@markkuleinio markkuleinio deleted the endpoint-url-fix branch January 6, 2021 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API .save() calls Fail when API host is in the format host:port

2 participants