mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
eslint: enable extra rules
no-implicit-coercion, no-extra-boolean-cast, no-invalid-this, logical-assignment-operators, no-unmodified-loop-condition
This commit is contained in:
1 parent
5ac9d930b2
commit
7f51df236a
34 files changed
+100
-96
No files matched your search
@@ -57,7 +57,7 @@ export class FilesHandler extends Handler {
|
||||
if (size >= system.get('limit.user_files_size')) {
|
||||
if (!this.user.hasPriv(PRIV.PRIV_UNLIMITED_QUOTA)) throw new FileLimitExceededError('size');
|
||||
}
|
||||
if (!filename) filename = file.originalFilename || String.random(16);
|
||||
filename ||= file.originalFilename || String.random(16);
|
||||
if (filename.includes('/') || filename.includes('..')) throw new ValidationError('filename', null, 'Bad filename');
|
||||
if (this.user._files.filter((i) => i.name === filename).length) throw new FileExistsError(filename);
|
||||
await storage.put(`user/${this.user._id}/${filename}`, file.filepath, this.user._id);
|
||||
|
||||
Reference in new issue
Block a user