summaryrefslogtreecommitdiff
path: root/src/api/models/drive-file.ts
blob: 4c7204b1f41057e2fa4e562b0c3628e152ea0965 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import db from '../../db/mongodb';

const collection = db.get('drive_files');

(collection as any).index('hash'); // fuck type definition

export default collection as any; // fuck type definition

export function validateFileName(name: string): boolean {
	return (
		(name.trim().length > 0) &&
		(name.length <= 200) &&
		(name.indexOf('\\') === -1) &&
		(name.indexOf('/') === -1) &&
		(name.indexOf('..') === -1)
	);
}