Add old fields, fix md5, fix migratins.
All checks were successful
/ release (push) Successful in 50s
All checks were successful
/ release (push) Successful in 50s
This commit is contained in:
parent
d25890ad26
commit
808953f46f
4 changed files with 24 additions and 2 deletions
|
@ -175,7 +175,19 @@ func handleUpload(w http.ResponseWriter, r *http.Request) {
|
|||
modTime := info.ModTime().UTC().Round(time.Second)
|
||||
size := info.Size()
|
||||
|
||||
_, err = tx.Exec(r.Context(), "UPDATE files SET hash = $2, size = $3, mod_time = $3 WHERE id = $1", fileid, hash, size, modTime)
|
||||
_, err = tx.Exec(r.Context(), "UPDATE files SET old_md5 = md5, old_size = size WHERE id = $1", fileid)
|
||||
if err != nil {
|
||||
errorUpload(r, w, taskid, "Set File Hash", err)
|
||||
return
|
||||
}
|
||||
|
||||
_, err = tx.Exec(r.Context(), "UPDATE files SET md5 = $2, size = $3, mod_time = $3 WHERE id = $1", fileid, hash, size, modTime)
|
||||
if err != nil {
|
||||
errorUpload(r, w, taskid, "Set File Hash", err)
|
||||
return
|
||||
}
|
||||
|
||||
_, err = tx.Exec(r.Context(), "UPDATE files SET md5 = $2, size = $3, mod_time = $3 WHERE id = $1", fileid, hash, size, modTime)
|
||||
if err != nil {
|
||||
errorUpload(r, w, taskid, "Set File Hash", err)
|
||||
return
|
||||
|
@ -188,6 +200,8 @@ func handleUpload(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
slog.InfoContext(r.Context(), "Original file Replaced with Uploaded File", "fileid", id, "dstPath", dstPath)
|
||||
} else {
|
||||
// TODO implement "old" fields for non replace libraries, scan also needs to use old field if it is is non replace and the file has been transcoded
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue