mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 03:14:03 +03: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
@ -25,6 +25,21 @@ describe('Actor', function () {
|
||||
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 () {
|
||||
|
@ -6,6 +6,7 @@ export class URI extends 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…
Reference in New Issue
Block a user