Skip to content

Commit 931963c

Browse files
committed
Update file size metadata for uploaded GeoPackage after it is indexed....again
This change was lost with the upgrade to GP 3.0 and now is back
1 parent 4320686 commit 931963c

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

routes/layers.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,16 @@ module.exports = function(app, security) {
156156
layerStatus.description = progress.description;
157157
layer.save();
158158
})
159+
.then(() => {
160+
return new Promise((resolve) => {
161+
// GeoPackage file size may have changed after index, update the metadata
162+
fs.stat(path.join(environment.layerBaseDirectory, layer.file.relativePath))
163+
.then((stats) => {
164+
layer.file.size = stats.size;
165+
resolve()
166+
});
167+
})
168+
})
159169
.then(() => {
160170
layer.processing = undefined;
161171
layer.state = 'available';

utilities/geopackage.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ async function optimize(path, progress) {
7474
const featureDao = geoPackage.getFeatureDao(table);
7575
success = success && (await featureDao.index(progress));
7676
}
77+
geoPackage.close();
7778
resolve(success);
7879
}, 0);
7980
});

0 commit comments

Comments
 (0)