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

Function isValidLogoImageBuffer

server/modules/logoUploadSecurity.js:100–112  ·  view source on GitHub ↗
(buffer, mimeType)

Source from the content-addressed store, hash-verified

98};
99
100const isValidLogoImageBuffer = (buffer, mimeType) => {
101 const normalizedMimeType = normalizeMimeType(mimeType);
102 if (!isAllowedLogoMimeType(normalizedMimeType)) {
103 return false;
104 }
105
106 if (normalizedMimeType === "image/svg+xml") {
107 return isSafeSvgBuffer(buffer);
108 }
109
110 const detectedMimeType = getImageTypeFromBuffer(buffer);
111 return detectedMimeType === normalizedMimeType;
112};
113
114const buildSafeLogoFilename = (mimeType, idGenerator) => {
115 const normalizedMimeType = normalizeMimeType(mimeType);

Callers 2

parseUploadFunction · 0.85

Calls 4

normalizeMimeTypeFunction · 0.85
isAllowedLogoMimeTypeFunction · 0.85
isSafeSvgBufferFunction · 0.85
getImageTypeFromBufferFunction · 0.85

Tested by

no test coverage detected