MCPcopy Create free account
hub / github.com/chartbrew/chartbrew / resolveSafeUploadPath

Function resolveSafeUploadPath

server/modules/logoUploadSecurity.js:125–132  ·  view source on GitHub ↗
(uploadDirectory, fileName)

Source from the content-addressed store, hash-verified

123};
124
125const resolveSafeUploadPath = (uploadDirectory, fileName) => {
126 const resolvedDirectory = path.resolve(uploadDirectory);
127 const resolvedPath = path.resolve(resolvedDirectory, fileName);
128 if (!resolvedPath.startsWith(`${resolvedDirectory}${path.sep}`)) {
129 return null;
130 }
131 return resolvedPath;
132};
133
134module.exports = {
135 MAX_LOGO_UPLOAD_SIZE_BYTES,

Callers 2

parseUploadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected