Skip to content

Commit bb130a7

Browse files
fit2botw940853815
andauthored
fix(sftp): use create-only saves for new files (#1752)
Co-authored-by: wangruidong <940853815@qq.com>
1 parent 4950aac commit bb130a7

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

‎ui/koko/composables/sftp/useSftpOperations.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,9 +512,7 @@ export function useSftpOperations(currentPath: Ref<string>, socket: SftpSocketCl
512512
listDirectory,
513513
createDirectory: (name) => mutatePath(SftpCommand.MakeDirectory, joinSftpPath(currentPath.value, name)),
514514
createDirectoryAt: (path) => mutatePath(SftpCommand.MakeDirectory, path),
515-
// koko parses upload message IDs as integers, including empty-file uploads.
516-
createFileAt: (path) =>
517-
uploadQueue.enqueue(() => sendUpload(String(Date.now()), { offset: 0, size: 0, path, chunk: false })),
515+
createFileAt: (path) => saveFile(path, new Uint8Array(), { expectedVersion: "absent" }).then(() => undefined),
518516
renameEntry: (entry, name) =>
519517
mutatePath(SftpCommand.Rename, joinSftpPath(currentPath.value, entry.name), { new_name: name }),
520518
renamePath: (path, name) => mutatePath(SftpCommand.Rename, path, { new_name: name }),

0 commit comments

Comments
 (0)