return delete token
this somehow didnt end up in the previous commit??
This commit is contained in:
+4
-1
@@ -1,7 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/rand"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
@@ -28,7 +30,7 @@ func health(w http.ResponseWriter, r *http.Request) {
|
|||||||
fmt.Fprintln(w, "OK")
|
fmt.Fprintln(w, "OK")
|
||||||
}
|
}
|
||||||
|
|
||||||
type uploadInput struct {
|
type UploadInput struct {
|
||||||
Reader io.Reader
|
Reader io.Reader
|
||||||
Filename string
|
Filename string
|
||||||
MIMEType string
|
MIMEType string
|
||||||
@@ -191,6 +193,7 @@ func uploadHandler(db *gorm.DB, cfg Config) http.HandlerFunc {
|
|||||||
SHA256: hasher.Sum(nil),
|
SHA256: hasher.Sum(nil),
|
||||||
CreatedAt: createdAt,
|
CreatedAt: createdAt,
|
||||||
LastAccessedAt: createdAt,
|
LastAccessedAt: createdAt,
|
||||||
|
DeleteToken: rand.Text(),
|
||||||
}
|
}
|
||||||
err = insertUpload(db, &upload)
|
err = insertUpload(db, &upload)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user