Merge remote-tracking branch 'klokantech/master' into public_url
# Conflicts: # src/main.js # src/server.js
This commit is contained in:
@@ -122,12 +122,18 @@ module.exports = function(options, repo, params, id, publicUrl, dataResolver) {
|
||||
var existingFonts = {};
|
||||
var fontListingPromise = new Promise(function(resolve, reject) {
|
||||
fs.readdir(options.paths.fonts, function(err, files) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
files.forEach(function(file) {
|
||||
fs.stat(path.join(options.paths.fonts, file), function(err, stats) {
|
||||
if (!err) {
|
||||
if (stats.isDirectory()) {
|
||||
existingFonts[path.basename(file)] = true;
|
||||
}
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
if (stats.isDirectory()) {
|
||||
existingFonts[path.basename(file)] = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -182,7 +188,12 @@ module.exports = function(options, repo, params, id, publicUrl, dataResolver) {
|
||||
}
|
||||
|
||||
if (format == 'pbf') {
|
||||
response.data = zlib.unzipSync(data);
|
||||
try {
|
||||
response.data = zlib.unzipSync(data);
|
||||
}
|
||||
catch (err) {
|
||||
console.log("Skipping incorrect header for tile mbtiles://%s/%s/%s/%s.pbf", id, z, x, y);
|
||||
}
|
||||
if (options.dataDecoratorFunc) {
|
||||
response.data = options.dataDecoratorFunc(
|
||||
sourceId, 'data', response.data, z, x, y);
|
||||
@@ -740,9 +751,8 @@ module.exports = function(options, repo, params, id, publicUrl, dataResolver) {
|
||||
return res.send(info);
|
||||
});
|
||||
|
||||
return new Promise(function(resolve, reject) {
|
||||
Promise.all([fontListingPromise, renderersReadyPromise]).then(function() {
|
||||
resolve(app);
|
||||
});
|
||||
return Promise.all([fontListingPromise, renderersReadyPromise]).then(function() {
|
||||
return app;
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user