smc-hub
Version:
CoCalc: Backend webserver component
18 lines • 749 B
JavaScript
;
/*
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
* License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.path_to_files = exports.redirect_to_directory = void 0;
// redirect /[uuid] and /[uuid]?query=123 to /[uuid]/ and /[uuid]/?query=123
function redirect_to_directory(req, res) {
var query = req.url.slice(req.path.length);
return res.redirect(301, req.baseUrl + req.path + "/" + query);
}
exports.redirect_to_directory = redirect_to_directory;
function path_to_files(path, project_id) {
return path.replace("[project_id]", project_id);
}
exports.path_to_files = path_to_files;
//# sourceMappingURL=util.js.map