Skip to content

PATCH on non-RDF resources fails with conversion error #2097

@angelo-v

Description

@angelo-v

Environment

  • Server version: 7.1.7
  • Node.js version: v25.2.1
  • npm version: 11.6.2

Description

Non-RDF resources (e.g., .txt, .jpg, .pdf files) return an Accept-Patch header advertising support for RDF patch formats (text/n3, application/sparql-update), but when clients attempt to PATCH these resources with RDF data, they receive a 501 Not Implemented error stating "No conversion path could be made from text/plain to internal/quads".

Expected Behavior

When a client sends a PATCH request with RDF content (N3 Patch or SPARQL Update) to a non-RDF resource, the server should successfully apply the patch to the corresponding .meta file:

PATCH /document.txt HTTP/1.1
Content-Type: application/sparql-update

INSERT DATA { <#subject> <#predicate> "value" . }

HTTP/1.1 205 Reset Content

The patch should be applied to /document.txt.meta, allowing clients to add metadata to non-RDF resources using the resource URL directly.

Actual Behavior

The server returns a 501 error when attempting to PATCH a non-RDF resource with RDF data:

GET /document.txt HTTP/1.1

HTTP/1.1 200 OK
Content-Type: text/plain
Accept-Patch: text/n3, application/sparql-update
PATCH /document.txt HTTP/1.1
Content-Type: application/sparql-update

INSERT DATA { <#subject> <#predicate> "value" . }

HTTP/1.1 501 Not Implemented
Content-Type: application/json

{
  "name": "NotImplementedHttpError",
  "message": "No conversion path could be made from text/plain to internal/quads:1,internal/*:0.",
  "statusCode": 501,
  "errorCode": "H501",
  "details": {}
}

Steps to Reproduce

  1. Start the Community Solid Server with default configuration
  2. Create a non-RDF resource:
    curl -X PUT http://localhost:3000/test.txt \
      -H "Content-Type: text/plain" \
      -d "test content"
  3. Verify it advertises Accept-Patch:
    curl -i http://localhost:3000/test.txt | grep -i accept-patch
    # Returns: Accept-Patch: text/n3, application/sparql-update
  4. Try to PATCH with RDF data:
    curl -X PATCH http://localhost:3000/test.txt \
      -H "Content-Type: application/sparql-update" \
      -d "INSERT DATA { <#s> <#p> <#o> . }"
  5. Observe the 501 error response:
    {
      "name": "NotImplementedHttpError",
      "message": "No conversion path could be made from text/plain to internal/quads:1,internal/*:0.",
      "statusCode": 501
    }
  6. Verify that PATCHing the .meta file directly works:
    curl -X PATCH http://localhost:3000/test.txt.meta \
      -H "Content-Type: application/sparql-update" \
      -d "INSERT DATA { <#s> <#p> <#o> . }"
    # Returns: 205 Reset Content (success)

Impact

  • Clients cannot use the Accept-Patch header to add metadata to non-RDF resources
  • The advertised capability (Accept-Patch: text/n3, application/sparql-update) is misleading
  • Clients must know to PATCH .meta files specifically, rather than using the resource URL

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions