23 lines
683 B
Go
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"}
|
|
}
|