fix: 修改uploadFiles和container上传
This commit is contained in:
@@ -65,7 +65,25 @@ export const cachePage = async (page: PageModel, opts: { tokenUser: any; key; ve
|
||||
},
|
||||
];
|
||||
};
|
||||
|
||||
export const uploadMinioContainer = async ({ tokenUser, key, version, code, filePath }) => {
|
||||
if ((filePath as string).includes('..')) {
|
||||
throw new CustomError('file path is invalid');
|
||||
}
|
||||
const minioKeyVersion = `${tokenUser.username}/${key}/${version}`;
|
||||
const minioPath = path.join(minioKeyVersion, filePath);
|
||||
console.log('minioPath', minioPath);
|
||||
// const isHTML = filePath.endsWith('.html');
|
||||
const name = minioPath.replace(minioKeyVersion + '/', '');
|
||||
await minioClient.putObject(bucketName, minioPath, code, code.length, {
|
||||
'Content-Type': getContentType(filePath),
|
||||
'app-source': 'user-app',
|
||||
'Cache-Control': 'no-cache', // 缓存一年
|
||||
});
|
||||
return {
|
||||
name,
|
||||
path: minioPath,
|
||||
};
|
||||
};
|
||||
export const uploadMinio = async ({ tokenUser, key, version, path, filePath }) => {
|
||||
const minioPath = `${tokenUser.username}/${key}/${version}/${path}`;
|
||||
const isHTML = filePath.endsWith('.html');
|
||||
|
||||
Reference in New Issue
Block a user