Skip to content

Commit

Permalink
Added a condition to evaluate if isAuthenticated is true (fixes error…
Browse files Browse the repository at this point in the history
… when a non authenticated request is made to a public route)
  • Loading branch information
imcarlosguerrero committed Nov 28, 2024
1 parent a642e6a commit 54a800e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/middlewares/is-owner-or-is-public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default (config: any, { strapi }: { strapi: Core.Strapi }) => {
const user = ctx.state.user;
const userId = user?.documentId;

if (!userId) {
if (!userId && !ctx.state.isAuthenticated) {
return ctx.unauthorized(`You can't access this entry.`);
}

Expand Down

0 comments on commit 54a800e

Please sign in to comment.