1
0
Fork 0

Fix defaultDocument in Foxx legacy

Opt-out values (i.e. empty strings) are now handled correctly again.
This commit is contained in:
Alan Plum 2016-02-29 14:22:07 +01:00
parent 86997527bf
commit 71ea230d4f
No known key found for this signature in database
GPG Key ID: 8ED72A9A323B6EFD
2 changed files with 6 additions and 2 deletions

View File

@ -333,8 +333,8 @@ function mountController(service, mount, filename) {
}
exports.routeService = function (service, throwOnErrors) {
const defaultDocument = service.manifest.defaultDocument;
let error = null;
let defaultDocument = service.manifest.defaultDocument || 'index.html';
service.routes = {
urlPrefix: '',
@ -352,7 +352,7 @@ exports.routeService = function (service, throwOnErrors) {
}
};
if ((service.mount + defaultDocument) !== service.mount) {
if (defaultDocument) {
// only add redirection if src and target are not the same
service.routes.routes.push({
url: {match: '/'},

View File

@ -352,6 +352,10 @@ function checkManifest(filename, manifest) {
});
}
if (legacy && manifest.defaultDocument === undefined) {
manifest.defaultDocument = 'index.html';
}
if (typeof manifest.controllers === 'string') {
manifest.controllers = {'/': manifest.controllers};
}