Skip to content

Commit 99b3219

Browse files
committed
webId relative to pod
1 parent 1034123 commit 99b3219

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/models/account-template.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const recursiveRead = require('recursive-readdir')
66
const fsUtils = require('../common/fs-utils')
77
const templateUtils = require('../common/template-utils')
88
const LDP = require('../ldp')
9+
const { URL } = require('url')
910

1011
const TEMPLATE_EXTENSIONS = ['.acl', '.meta', '.json', '.hbs', '.handlebars']
1112
const TEMPLATE_FILES = ['card']
@@ -72,9 +73,12 @@ class AccountTemplate {
7273
* @return {Object}
7374
*/
7475
static templateSubstitutionsFor (userAccount) {
76+
const webUri = new URL(userAccount.webId)
77+
const webIdOrigin = webUri.protocol + '//' + webUri.hostname
78+
const podRelWebId = userAccount.webId.replace(webIdOrigin, '')
7579
const substitutions = {
7680
name: userAccount.displayName,
77-
webId: userAccount.externalWebId ? userAccount.webId : '/profile/card#me',
81+
webId: userAccount.externalWebId ? userAccount.webId : podRelWebId,
7882
email: userAccount.email,
7983
idp: userAccount.idp
8084
}

0 commit comments

Comments
 (0)