Numerous Bug Fixes
Some checks failed
Automated Container Build / build-and-push (push) Failing after 8s
Some checks failed
Automated Container Build / build-and-push (push) Failing after 8s
This commit is contained in:
parent
02eefdac0e
commit
267d429122
959 changed files with 145571 additions and 221 deletions
|
|
@ -83,6 +83,10 @@ func (h *TusHandler) Create(c *fiber.Ctx) error {
|
|||
destPath = "."
|
||||
}
|
||||
|
||||
// Resolve destination directory and ensure unique filename
|
||||
destFull := filepath.Join(h.Config.StorageDir, filepath.FromSlash(destPath))
|
||||
uniqueFileName := GetUniquePath(destFull, fileName)
|
||||
|
||||
// Generate unique upload ID
|
||||
uploadID, err := generateUploadID()
|
||||
if err != nil {
|
||||
|
|
@ -103,12 +107,12 @@ func (h *TusHandler) Create(c *fiber.Ctx) error {
|
|||
|
||||
upload := &tusUpload{
|
||||
ID: uploadID,
|
||||
FilePath: filepath.ToSlash(filepath.Join(destPath, fileName)),
|
||||
FileName: fileName,
|
||||
FilePath: filepath.ToSlash(filepath.Join(destPath, uniqueFileName)),
|
||||
FileName: uniqueFileName,
|
||||
FileSize: fileSize,
|
||||
Offset: 0,
|
||||
TempPath: tempPath,
|
||||
MimeType: mime.TypeByExtension(filepath.Ext(fileName)),
|
||||
MimeType: mime.TypeByExtension(filepath.Ext(uniqueFileName)),
|
||||
}
|
||||
|
||||
h.mu.Lock()
|
||||
|
|
@ -231,9 +235,6 @@ func (h *TusHandler) finalizeUpload(upload *tusUpload, ip string) {
|
|||
// Ensure parent dir exists
|
||||
os.MkdirAll(filepath.Dir(destFull), 0755)
|
||||
|
||||
// Version existing file if it exists
|
||||
CreateVersion(h.DB, h.Config, destFull, filepath.ToSlash(upload.FilePath))
|
||||
|
||||
// Move temp file to final location
|
||||
if err := os.Rename(upload.TempPath, destFull); err != nil {
|
||||
fmt.Printf("Error finalizing upload %s: %v\n", upload.ID, err)
|
||||
|
|
|
|||
Reference in a new issue