Readthedocs.org: Validate webhook URL

Created on 4 Feb 2020  路  8Comments  路  Source: readthedocs/readthedocs.org

We have errors like Invalid URL '': No schema supplied. Perhaps you meant http://?

Where users don't put https:// to their urls. We could, add https:// if it wasn't given before save it or ask explicitly to the user to put https?://

ref https://sentry.io/organizations/read-the-docs/issues/789512412/?project=148442&query=is%3Aunresolved

Accepted Bug Good First Issue Improvement

All 8 comments

We want to validate the URL when creating a webhook via the Project's Admin -> Notifications -> "New Webhook Notifications"

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

馃憢

Is this still valid? Happy to take a look.

Hey @santos22! Yes. This is valid. Please go ahead and propose a PR :smiling_face_with_three_hearts:

Is there an example of an invalid URL that went through? I don't have access to the Sentry project. Looks like Django assumes 'http' if no scheme is given.

Reference:
https://github.com/django/django/blob/188b003014dc727ca22f7fafb21cf2fa0b3472d2/django/forms/fields.py#L695

@santos22 you are right, we already use an URLField. I checked the DB and looks like we have some empty values.

We should make that field non-blank/null instead of checking for the protocol https://github.com/readthedocs/readthedocs.org/blob/4e095bf79f7db30e5654466768070da7fe08cfba/readthedocs/projects/models.py#L1448-L1452

I'll remove those invalid values

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SylvainCorlay picture SylvainCorlay  路  3Comments

goerz picture goerz  路  4Comments

gtalarico picture gtalarico  路  4Comments

davidfischer picture davidfischer  路  4Comments

JiaweiZhuang picture JiaweiZhuang  路  3Comments