mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 03:14:03 +03:00
Updated Tier welcomePageURL to be a string rather than URL
refs https://github.com/TryGhost/Team/issues/2078 We allow passing in relative URLs for the welcome page, so we need to accept a string for this property.
This commit is contained in:
parent
b607bee27f
commit
581164ed60
@ -41,7 +41,7 @@ module.exports = class Tier {
|
||||
this.#description = validateDescription(value);
|
||||
}
|
||||
|
||||
/** @type {URL} */
|
||||
/** @type {string} */
|
||||
#welcomePageURL;
|
||||
get welcomePageURL() {
|
||||
return this.#welcomePageURL;
|
||||
@ -243,20 +243,15 @@ function validateName(value) {
|
||||
}
|
||||
|
||||
function validateWelcomePageURL(value) {
|
||||
if (value instanceof URL) {
|
||||
return value;
|
||||
}
|
||||
if (!value) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return new URL(value);
|
||||
} catch (err) {
|
||||
throw new ValidationError({
|
||||
err,
|
||||
message: 'Tier Welcome Page URL must be a URL'
|
||||
});
|
||||
if (value === null || typeof value === 'string') {
|
||||
return value;
|
||||
}
|
||||
throw new ValidationError({
|
||||
message: 'Tier Welcome Page URL must be a string'
|
||||
});
|
||||
}
|
||||
|
||||
function validateDescription(value) {
|
||||
|
Loading…
Reference in New Issue
Block a user