Skip to content

Wrong error response if user lacks of permission to create a link over a space #12179

@jesmrec

Description

@jesmrec

Describe the bug

Creating a space link with incorrect permissions returns a 400 instead of a 403 , causing a wrong error message in clients.

Steps to reproduce - Actual behavior

The following curl creates a link over a space.

curl -H 'Authorization: Bearer xxx' \
-X POST 'https://xx.xx.xx.xx:9200/graph/v1beta1/drives/<drive-id>/root/createLink' -d '{"displayName":"test","password":"...","type":"view"}'

If the user is not allowed to perform that actions, server returns with a 400 and the following payload:

{
    "error": {
        "code": "invalidRequest",
        "innererror": {
            "date": "2026-04-01T11:31:31Z",
            "request-id": "1b253441-34b5-4324-856e-041d18be46ea"
        },
        "message": "no share permission"
    }
}

Expected behavior

Error code should be 403 Forbidden instead of 400

Setup

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions