Merge pull request #375 from mouse-reeve/username-regex

Allow usernames with dots
This commit is contained in:
Mouse Reeve 2020-12-02 15:27:03 -08:00 committed by GitHub
commit 8fb8e93e37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,8 +6,8 @@ from django.urls import path, re_path
from bookwyrm import incoming, outgoing, views, settings, wellknown from bookwyrm import incoming, outgoing, views, settings, wellknown
from bookwyrm import view_actions as actions from bookwyrm import view_actions as actions
username_regex = r'(?P<username>[\w\-_]+@[\w\-\_\.]+)' username_regex = r'(?P<username>[\w\-_\.]+@[\w\-\_\.]+)'
localname_regex = r'(?P<username>[\w\-_]+)' localname_regex = r'(?P<username>[\w\-_\.]+)'
user_path = r'^user/%s' % username_regex user_path = r'^user/%s' % username_regex
local_user_path = r'^user/%s' % localname_regex local_user_path = r'^user/%s' % localname_regex
@ -61,8 +61,8 @@ urlpatterns = [
# should return a ui view or activitypub json blob as requested # should return a ui view or activitypub json blob as requested
# users # users
re_path(r'%s/?$' % user_path, views.user_page), re_path(r'%s/?$' % user_path, views.user_page),
re_path(r'%s/?$' % local_user_path, views.user_page),
re_path(r'%s\.json$' % local_user_path, views.user_page), re_path(r'%s\.json$' % local_user_path, views.user_page),
re_path(r'%s/?$' % local_user_path, views.user_page),
re_path(r'%s/shelves/?$' % local_user_path, views.user_shelves_page), re_path(r'%s/shelves/?$' % local_user_path, views.user_shelves_page),
re_path(r'%s/followers(.json)?/?$' % local_user_path, views.followers_page), re_path(r'%s/followers(.json)?/?$' % local_user_path, views.followers_page),
re_path(r'%s/following(.json)?/?$' % local_user_path, views.following_page), re_path(r'%s/following(.json)?/?$' % local_user_path, views.following_page),