Skip to content

Commit

Permalink
add ability to replace temporary paths in linked resources
Browse files Browse the repository at this point in the history
  • Loading branch information
scottaubrey committed Dec 21, 2023
1 parent 402c1eb commit f949f23
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,27 @@ app.post('/', async (req, res) => {
},
};

const replacementPath = typeof req.query.replacementPath === 'string' ? req.query.replacementPath : '';

const versionResponders = {
'application/vnd.elife.encoda.v1.0.3+json': async () => {
res.json({
version: '1.0.3',
json: await convert_1_0_3(xmlFile, undefined, parameters),
json: (await convert_1_0_3(xmlFile, undefined, parameters))?.replaceAll(tempOutput, replacementPath),
});
rmdirSync(tempOutput, { recursive: true });
},
'application/vnd.elife.encoda.v1.0.2+json': async () => {
res.json({
version: '1.0.2',
json: await convert_1_0_2(xmlFile, undefined, parameters),
json: (await convert_1_0_2(xmlFile, undefined, parameters))?.replaceAll(tempOutput, replacementPath),
});
rmdirSync(tempOutput, { recursive: true });
},
'application/vnd.elife.encoda.v1.0.1+json': async () => {
res.json({
version: '1.0.1',
json: await convert_1_0_1(xmlFile, undefined, parameters),
json: (await convert_1_0_1(xmlFile, undefined, parameters))?.replaceAll(tempOutput, replacementPath),
});
rmdirSync(tempOutput, { recursive: true });
},
Expand Down

0 comments on commit f949f23

Please sign in to comment.