fix(remote download): improve file pre-upload validation (fix #2286)

This commit is contained in:
Aaron Liu
2025-04-24 15:26:58 +08:00
parent 224ac28ffe
commit 969e35192a
4 changed files with 76 additions and 26 deletions

View File

@@ -103,6 +103,8 @@ type (
CompleteUpload(ctx context.Context, session *UploadSession) (File, error)
// CancelUploadSession cancels an upload session. Delete the placeholder file if no other entity is created.
CancelUploadSession(ctx context.Context, path *URI, sessionID string, session *UploadSession) ([]Entity, error)
// PreValidateUpload pre-validates an upload request.
PreValidateUpload(ctx context.Context, dst *URI, files ...PreValidateFile) error
}
LockSystem interface {
@@ -369,6 +371,12 @@ type (
ParentFiles []int `json:"parent_files"`
PrimaryEntityParentFiles []int `json:"primary_entity_parent_files"`
}
PreValidateFile struct {
Name string
Size int64
OmitName bool // if true, file name will not be validated
}
)
const (