Skip to content

fix : return 404 instead of 401 when accessing a deleted document via share link #1453

Description

@tmdeveloper007

Summary of What Needs to be Done:
The documents.py endpoint returns HTTP 401 Unauthorized when a document has been soft-deleted (is_deleted=True) and accessed via a share link. Since the document no longer exists from the client's perspective, the correct status code is 404 Not Found. The current behavior is semantically incorrect and can confuse API consumers.

Changes that Need to be Made:

  • backend/app/api/v1/documents.py: change status_code=status.HTTP_401_UNAUTHORIZED to status.HTTP_404_NOT_FOUND on the branch that handles is_deleted documents.

Impact that it would Provide:

  • Correct HTTP semantics: deleted resources return 404, not 401.
  • Prevents client-side confusion where a valid auth context gets a 401 for a document that simply no longer exists.

Note: Please assign this issue to the tmdeveloper007 account.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions