getPod() assumes subdomain pattern, breaks path-based pods
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 153
- Fork
- 46
- Merge medio
- 1g 8h
- PR unite (30g)
- 7
Descrizione
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
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia da getPod() in src/utils/headerFooterHelpers.ts e verifica come authn.currentUser(), i dati WebID e storage siano disponibili nelle utility circostanti. Verifica il comportamento con un pod basato sul percorso come http://server.com/alice/ e mantieni il fallback esistente basato sull’origine per i pod su sottodominio.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- authentication
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 48/100