diff --git a/app/activitypub/routes.py b/app/activitypub/routes.py index 0b6e134a..3c95e2b5 100644 --- a/app/activitypub/routes.py +++ b/app/activitypub/routes.py @@ -207,18 +207,18 @@ def user_profile(actor): # admins can view deleted accounts if current_user.is_authenticated and current_user.is_admin(): if '@' in actor: - user: User = User.query.filter_by(ap_id=actor).first() + user: User = User.query.filter_by(ap_id=actor.lower()).first() else: user: User = User.query.filter_by(user_name=actor, ap_id=None).first() if user is None: user = User.query.filter_by(ap_profile_id=f'https://{current_app.config["SERVER_NAME"]}/u/{actor}', deleted=False, ap_id=None).first() else: if '@' in actor: - user: User = User.query.filter_by(ap_id=actor, deleted=False, banned=False).first() + user: User = User.query.filter_by(ap_id=actor.lower(), deleted=False, banned=False).first() else: user: User = User.query.filter_by(user_name=actor, deleted=False, ap_id=None).first() if user is None: - user = User.query.filter_by(ap_profile_id=f'https://{current_app.config["SERVER_NAME"]}/u/{actor}', deleted=False, ap_id=None).first() + user = User.query.filter_by(ap_profile_id=f'https://{current_app.config["SERVER_NAME"]}/u/{actor.lower()}', deleted=False, ap_id=None).first() if user is not None: if request.method == 'HEAD': diff --git a/app/activitypub/util.py b/app/activitypub/util.py index 1dff886d..643e9bb6 100644 --- a/app/activitypub/util.py +++ b/app/activitypub/util.py @@ -569,7 +569,7 @@ def actor_json_to_model(activity_json, address, server): indexable=activity_json['indexable'] if 'indexable' in activity_json else False, searchable=activity_json['discoverable'] if 'discoverable' in activity_json else True, created=activity_json['published'] if 'published' in activity_json else utcnow(), - ap_id=f"{address}@{server}", + ap_id=f"{address.lower()}@{server.lower()}", ap_public_url=activity_json['id'], ap_profile_id=activity_json['id'].lower(), ap_inbox_url=activity_json['endpoints']['sharedInbox'] if 'endpoints' in activity_json else activity_json['inbox'] if 'inbox' in activity_json else '', @@ -628,7 +628,7 @@ def actor_json_to_model(activity_json, address, server): private_mods=activity_json['privateMods'] if 'privateMods' in activity_json else False, created_at=activity_json['published'] if 'published' in activity_json else utcnow(), last_active=activity_json['updated'] if 'updated' in activity_json else utcnow(), - ap_id=f"{address[1:]}@{server}" if address.startswith('!') else f"{address}@{server}", + ap_id=f"{address[1:].lower()}@{server.lower()}" if address.startswith('!') else f"{address}@{server}", ap_public_url=activity_json['id'], ap_profile_id=activity_json['id'].lower(), ap_followers_url=activity_json['followers'],