forked from tsai/budibase
21 changed files with 73 additions and 37 deletions
@ -1,3 +1,3 @@ |
|||||
const { join } = require("path") |
const { join } = require("../sanitisedPath") |
||||
|
|
||||
module.exports = (appPath, pageName) => join(appPath, "public", pageName) |
module.exports = (appPath, pageName) => join(appPath, "public", pageName) |
||||
|
|||||
@ -0,0 +1,27 @@ |
|||||
|
const path = require("path") |
||||
|
|
||||
|
function sanitiseArgs(args) { |
||||
|
let sanitised = [] |
||||
|
for (let arg of args) { |
||||
|
sanitised.push(arg.replace(":", "")) |
||||
|
} |
||||
|
return sanitised |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Exactly the same as path.join but creates a sanitised path. |
||||
|
* @param args Any number of string arguments to add to a path |
||||
|
* @returns {string} The final path ready to use |
||||
|
*/ |
||||
|
exports.join = function(...args) { |
||||
|
return path.join(...sanitiseArgs(args)) |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Exactly the same as path.resolve but creates a sanitised path. |
||||
|
* @param args Any number of string arguments to add to a path |
||||
|
* @returns {string} The final path ready to use |
||||
|
*/ |
||||
|
exports.resolve = function(...args) { |
||||
|
return path.resolve(...sanitiseArgs(args)) |
||||
|
} |
||||
Loading…
Reference in new issue