mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-25 02:31:59 -05:00
Fixed bug with converting URI to value
Subdomains weren't working because of the missing trailing slash
This commit is contained in:
parent
5e0f1a1732
commit
17fe2395bd
2 changed files with 17 additions and 1 deletions
|
@ -25,6 +25,21 @@ describe('Actor', function () {
|
||||||
assert.equal(doesnaeHaveDisplayName.displayName, 'username');
|
assert.equal(doesnaeHaveDisplayName.displayName, 'username');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('actorId', function () {
|
||||||
|
it('Correctly returns the actor url', function () {
|
||||||
|
const actor = Actor.create({username: 'testing'});
|
||||||
|
const idString = actor.id.toHexString();
|
||||||
|
const actorId = actor.actorId;
|
||||||
|
|
||||||
|
const baseUrl = new URL('https://domain.tld/base');
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
actorId.getValue(baseUrl),
|
||||||
|
`https://domain.tld/base/actor/${idString}`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#createArticle', function () {
|
describe('#createArticle', function () {
|
||||||
|
|
|
@ -6,6 +6,7 @@ export class URI extends URL {
|
||||||
}
|
}
|
||||||
|
|
||||||
getValue(url: URL) {
|
getValue(url: URL) {
|
||||||
return this.href.replace(URI.BASE_URL.href, url.href);
|
const replaceValue = url.href.endsWith('/') ? url.href : url.href + '/';
|
||||||
|
return this.href.replace(URI.BASE_URL.href, replaceValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue