SolidOS / SolidOS/solid-ui

getPod() assumes subdomain pattern, breaks path-based pods

Open
#651 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
153
Forks
46
Avg merge
1d 8h
Merged PRs (30d)
7

Description

Problem

The getPod() function in src/utils/headerFooterHelpers.ts assumes pods are at the origin (subdomain pattern), which breaks path-based pod servers.

Current code (line 17-20):

export function getPod (): NamedNode {
  // @@ TODO: This is given that mashlib runs on NSS - might need to change when we want it to run on other Pod servers
  return sym(document.location.origin).site()
}

The TODO comment acknowledges this limitation.

Impact

When using a path-based pod server (e.g., http://server.com/alice/), after login:

  • WebID: http://server.com/alice/profile/card#me
  • getPod() returns: http://server.com/
  • Profile guess becomes: http://server.com/profile/card#me
  • Should be: http://server.com/alice/profile/card#me

This causes 404 errors when mashlib tries to load the user's profile.

Affected Servers

  • Any path-based pod server
  • CSS (Community Solid Server) supports both subdomain and path patterns
  • JSS (JavaScript Solid Server) uses path pattern

Suggested Fix

Derive the pod root from the logged-in user's WebID rather than assuming document.location.origin:

export function getPod (): NamedNode {
  const user = authn.currentUser()
  if (user) {
    // Extract pod root from WebID's pim:storage or by convention
    const storage = getStorage(user)
    if (storage) return storage
  }
  // Fallback to origin-based (subdomain pattern)
  return sym(document.location.origin).site()
}

Or use the pim:storage triple from the user's profile which explicitly declares the pod root.

Environment

  • solid-ui version: latest (via mashlib CDN)
  • Server: JSS (JavaScript Solid Server) with path-based pods

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with getPod() in src/utils/headerFooterHelpers.ts and inspect how authn.currentUser(), WebID data, and storage are available in the surrounding utilities. Verify the behavior with a path-based pod such as http://server.com/alice/ and preserve the existing origin-based fallback for subdomain pods.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
authentication
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.