The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/server/lib/dataExport/copyFileUpload.ts

14 lines
528 B

import { Uploads } from '@rocket.chat/models';
import type { FileProp } from '@rocket.chat/core-typings';
import { FileUpload } from '../../../app/file-upload/server';
import { joinPath } from '../fileUtils';
export const copyFileUpload = async (attachmentData: Pick<FileProp, '_id' | 'name'>, assetsPath: string): Promise<void> => {
const file = await Uploads.findOneById(attachmentData._id);
if (!file) {
return;
}
await FileUpload.copy(file, joinPath(assetsPath, `${attachmentData._id}-${attachmentData.name}`));
};