Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
MWParserEnvironment.prototype._makeTitle = function(urlDecodedText, defaultNS, noExceptions) {
try {
if (this.page && /^(\#|\/|\.\.\/)/.test(urlDecodedText)) {
defaultNS = this.page.ns;
}
urlDecodedText = this.resolveTitle(urlDecodedText);
return Title.newFromText(urlDecodedText, this.conf.wiki.siteInfo, defaultNS);
} catch (e) {
if (noExceptions) {
return null;
} else {
throw e;
}
}
};
return mwUtil.getSiteInfo(hyper, req, entry.project).then((siteinfo) => {
const title = Title.newFromText(entry.title, siteinfo).getPrefixedDBKey();
entry.summary = {
$merge: [
`${siteinfo.baseUri}/page/summary/${encodeURIComponent(title)}`
]
};
}).catch(() => {});
})
.then((siteInfo) => {
try {
return Title.newFromText(title, siteInfo);
} catch (e) {
throw new HTTPError({
status: 400,
body: {
type: 'bad_request',
detail: e.message
}
});
}
});