teamhephy / controller

Hephy Workflow Controller (API)
https://teamhephy.com
MIT License
14 stars 26 forks source link

Update rootfs/api/urls.py #164

Closed eudalov closed 2 years ago

eudalov commented 2 years ago

Fix for the issue https://github.com/teamhephy/controller/issues/162.

eudalov commented 2 years ago

@Cryptophobia , the same regexp is used in the same file, for another URL processing: https://github.com/teamhephy/controller/blob/b4c471f942fdf3ff039d6c55014f80c0799ea078/rootfs/api/urls.py#L113 It is used for parameter checking but not for the hostname.

Cryptophobia commented 2 years ago

@eudalov , it looks like in that first case the regex actually works. But here it seems to still fail? Any reason why that would be?

https://regex101.com/r/t5pza9/1

eudalov commented 2 years ago

@Cryptophobia , well, it's because the regular expression [-_\w.@+]+ applies only to the parameter username (the URL part coming after perms/ and untill next /) but not the whole URL: Screenshot_488 Here it is a Django docs about the syntax used in case with urlpatterns and regexps: https://docs.djangoproject.com/en/4.0/topics/http/urls/#using-regular-expressions.