fix: resolve IDE errors, minor UI tweaks, and implement file conflict resolution UI/API
Some checks failed
Automated Container Build / build-and-push (push) Failing after 1m13s
Some checks failed
Automated Container Build / build-and-push (push) Failing after 1m13s
This commit is contained in:
parent
3e34a37c95
commit
10bab4ea5b
7 changed files with 625 additions and 58 deletions
|
|
@ -107,6 +107,7 @@ func (h *TusHandler) Create(c *fiber.Ctx) error {
|
|||
metadata := parseTusMetadata(c.Get("Upload-Metadata"))
|
||||
fileName := metadata["filename"]
|
||||
destPath := metadata["path"]
|
||||
overwrite := metadata["overwrite"] == "true"
|
||||
|
||||
if fileName == "" {
|
||||
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{"error": "filename metadata is required"})
|
||||
|
|
@ -115,13 +116,15 @@ func (h *TusHandler) Create(c *fiber.Ctx) error {
|
|||
destPath = "."
|
||||
}
|
||||
|
||||
// Resolve destination directory and ensure unique filename
|
||||
destFull, err := resolveSafe(h.Config.StorageDir, destPath)
|
||||
if err != nil {
|
||||
return c.Status(fiber.StatusForbidden).JSON(fiber.Map{"error": "invalid destination path"})
|
||||
}
|
||||
|
||||
uniqueFileName := GetUniquePath(destFull, fileName)
|
||||
|
||||
uniqueFileName := fileName
|
||||
if !overwrite {
|
||||
uniqueFileName = GetUniquePath(destFull, fileName)
|
||||
}
|
||||
|
||||
// Generate unique upload ID
|
||||
uploadID, err := generateUploadID()
|
||||
|
|
|
|||
Reference in a new issue