Add file name to file hash

This commit is contained in:
Andreas Mieke 2021-03-07 23:42:11 +01:00
parent 0ef3949b61
commit 4bdf0a8b09

View file

@ -67,6 +67,7 @@ func encode(c *gin.Context) {
var newHash string
hasher := sha256.New()
hasher.Write([]byte(fparts[len(fparts)-1]))
io.Copy(hasher, src)
newHash = hex.EncodeToString(hasher.Sum(nil))
database.Db.Where("file_hash = ?", newHash).FirstOrInit(&URL)