diff --git a/lib/models/account-template.js b/lib/models/account-template.js index 7cc9c85e..ddb65c7f 100644 --- a/lib/models/account-template.js +++ b/lib/models/account-template.js @@ -74,8 +74,7 @@ class AccountTemplate { */ static templateSubstitutionsFor (userAccount) { const webUri = new URL(userAccount.webId) - const webIdOrigin = webUri.protocol + '//' + webUri.hostname + ':' + webUri.port - const podRelWebId = userAccount.webId.replace(webIdOrigin, '') + const podRelWebId = userAccount.webId.replace(webUri.origin, '') const substitutions = { name: userAccount.displayName, webId: userAccount.externalWebId ? userAccount.webId : podRelWebId, diff --git a/test/integration/account-manager-test.js b/test/integration/account-manager-test.js index 6eaaa3b3..a939dfce 100644 --- a/test/integration/account-manager-test.js +++ b/test/integration/account-manager-test.js @@ -139,7 +139,7 @@ describe('AccountManager', () => { const rootAcl = fs.readFileSync(path.join(accountDir, '.acl'), 'utf8') expect(rootAcl).to.include('') + expect(rootAcl).to.include('') }) }) }) diff --git a/test/integration/account-template-test.js b/test/integration/account-template-test.js index c6803b4d..02d195a5 100644 --- a/test/integration/account-template-test.js +++ b/test/integration/account-template-test.js @@ -73,7 +73,7 @@ describe('AccountTemplate', () => { const substitutions = AccountTemplate.templateSubstitutionsFor(userAccount) - expect(substitutions.webId).to.equal('https://alice.example.com/#me') + expect(substitutions.webId).to.equal('/#me') }) it('should not update the nested webid', () => { @@ -85,7 +85,7 @@ describe('AccountTemplate', () => { const substitutions = AccountTemplate.templateSubstitutionsFor(userAccount) - expect(substitutions.webId).to.equal('https://alice.example.com/alice/#me') + expect(substitutions.webId).to.equal('/alice/#me') }) it('should update the webid', () => { diff --git a/test/unit/account-template-test.js b/test/unit/account-template-test.js index 67bdf18e..3a2bd43b 100644 --- a/test/unit/account-template-test.js +++ b/test/unit/account-template-test.js @@ -54,7 +54,7 @@ describe('AccountTemplate', () => { const substitutions = AccountTemplate.templateSubstitutionsFor(userAccount) expect(substitutions.name).to.equal('Alice Q.') expect(substitutions.email).to.equal('alice@example.com') - expect(substitutions.webId).to.equal('https://alice.example.com/profile/card#me') + expect(substitutions.webId).to.equal('/profile/card#me') }) }) })