Filter image files for canvases

This commit is contained in:
Nicolò P 2023-10-17 11:12:30 +02:00
parent 24317a9eb2
commit 9c34e106c1
2 changed files with 9 additions and 2 deletions

View File

@ -11,7 +11,7 @@ router.get('/iiif/:manifestid/manifest', async function(req, res) {
res.json(manifest); res.json(manifest);
}); });
/* GET manifest JSON */ /* GET canvas JSON */
router.get('/iiif/:manifestid/canvas/:name', async function(req, res) { router.get('/iiif/:manifestid/canvas/:name', async function(req, res) {
const canvas = await generateCanvas(req.params.manifestid, req.params.name) const canvas = await generateCanvas(req.params.manifestid, req.params.name)
res.set('Access-Control-Allow-Origin', '*'); res.set('Access-Control-Allow-Origin', '*');

View File

@ -1,4 +1,5 @@
import * as fs from 'fs'; import * as fs from 'fs';
import * as path from 'path';
import Manifest from './Manifest.js'; import Manifest from './Manifest.js';
import Sequence from './Sequence.js'; import Sequence from './Sequence.js';
import Canvas from './Canvas.js'; import Canvas from './Canvas.js';
@ -17,7 +18,13 @@ Common.getImageList = async function (manifestId) {
let baseFolder = folderName.split('_')[0] + '_' + folderName.split('_')[1] + '_iiif'; let baseFolder = folderName.split('_')[0] + '_' + folderName.split('_')[1] + '_iiif';
return await fs.promises.readdir(`${process.env.IMAGES_DIR}/${baseFolder}/${folderName}`); let files = await fs.promises.readdir(
`${process.env.IMAGES_DIR}/${baseFolder}/${folderName}`
);
files = files.filter(file => path.extname(file) !== '.csv');
return files;
} }
/** /**
* @param {string} imageId The image's id as a URL to the image server * @param {string} imageId The image's id as a URL to the image server