Add file name to file hash
This commit is contained in:
parent
0ef3949b61
commit
4bdf0a8b09
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue