parent
48605e60e0
commit
8ec2a7789b
|
@ -39,14 +39,9 @@ func (Media) TableName() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Media) BeforeSave(tx *gorm.DB) error {
|
func (m *Media) BeforeSave(tx *gorm.DB) error {
|
||||||
// Update hashes
|
// Update path hash
|
||||||
m.PathHash = MD5Hash(m.Path)
|
m.PathHash = MD5Hash(m.Path)
|
||||||
|
|
||||||
if m.SideCarPath != nil {
|
|
||||||
encodedHash := MD5Hash(*m.SideCarPath)
|
|
||||||
m.SideCarHash = &encodedHash
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue