mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 23:06:00 +00:00
17 lines
509 B
JavaScript
17 lines
509 B
JavaScript
const path = require('path');
|
|
const { jsldir, archivedir, resolveArchiveFolder } = require('./directories');
|
|
|
|
function getJslFileName(jslid) {
|
|
const archiveMatch = jslid.match(/^archive:\/\/([^/]+)\/(.*)$/);
|
|
if (archiveMatch) {
|
|
return path.join(resolveArchiveFolder(archiveMatch[1]), `${archiveMatch[2]}.jsonl`);
|
|
}
|
|
const fileMatch = jslid.match(/^file:\/\/(.*)$/);
|
|
if (fileMatch) {
|
|
return fileMatch[1];
|
|
}
|
|
return path.join(jsldir(), `${jslid}.jsonl`);
|
|
}
|
|
|
|
module.exports = getJslFileName;
|