Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix /admin/purge routes returning 404 #3244

Merged
merged 1 commit into from
Jun 21, 2023

Conversation

kartikynwa
Copy link
Contributor

@kartikynwa kartikynwa commented Jun 21, 2023

Endpoints like /admin/purge/person were returning a 404. Nesting /purge as a service inside the /admin service fixes the problem. I am guessing actix-web descends into the /admin block since it is placed first then returns 404 when it does not find a /purge route within it.

Calling the endpoint after these changes:

 ❯ ./purge_user.sh
+ data='{  "person_id": 3,  "auth": "authtoken",  "reason": "terrible poster"}'
+ curl -i -H 'Content-Type: application/json' -X POST -d '{  "person_id": 3,  "auth": "authtoken",  "reason": "terrible poster"}' http://localhost:8536/api/v3/admin/purge/person
HTTP/1.1 200 OK
content-length: 16
access-control-expose-headers: content-type
access-control-allow-credentials: true
vary: Origin, Access-Control-Request-Method, Access-Control-Request-Headers
content-type: application/json
date: Wed, 21 Jun 2023 14:16:19 GMT

{"success":true}%

src/api_routes_http.rs Outdated Show resolved Hide resolved
@kartikynwa kartikynwa force-pushed the fix-admin-purge-route branch from 53c9efc to 6d996b4 Compare June 21, 2023 14:49
@kartikynwa kartikynwa requested a review from dessalines June 21, 2023 15:06
Copy link
Member

@dessalines dessalines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. We should probably add some tests for purge in our jest api_tests/ at some point.

@Nutomic Nutomic merged commit ef3544b into LemmyNet:main Jun 21, 2023
@kartikynwa kartikynwa deleted the fix-admin-purge-route branch June 22, 2023 01:39
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.

3 participants