Files
Kelx/fs-upload.go
T
2026-11-30 16:32:37 +00:00

23 lines
683 B
Go

package main
import "path/filepath"
func removeUploadTemp(scopeHandle *safeRoot, tmpRel string) {
if parentFd, err := safeOpenDirAt(scopeHandle, filepath.Dir(tmpRel)); err == nil {
_ = safeRemoveAt(parentFd, filepath.Base(tmpRel))
_ = parentFd.Close()
}
}
// adpanel:upload-no-clobber - PUT must not replace a file created during transfer.
func commitStagedUpload(root *safeRoot, tmpRel, name string, createOnly bool) error {
if createOnly {
return renameNoReplaceUnderRoot(root, tmpRel, name, true)
}
return safeRenameUnderRoot(root, tmpRel, name)
}
func uploadDestinationExists() map[string]any {
return map[string]any{"ok": false, "error": "destination_exists"}
}