admin: new route to check file on disk
This commit is contained in:
parent
5b30788cff
commit
20dfd99ec0
4 changed files with 27 additions and 6 deletions
|
|
@ -261,3 +261,14 @@ func ClearFiles() (int64, error) {
|
|||
func (f EFile) GetOrigin() string {
|
||||
return f.origin
|
||||
}
|
||||
|
||||
// CheckFileOnDisk recalculates the hash of the file on disk.
|
||||
func (f EFile) CheckFileOnDisk() error {
|
||||
if _, size, err := checkFileHash(path.Join(FilesDir, f.Path), f.Checksum); err != nil {
|
||||
return err
|
||||
} else if size == 0 {
|
||||
return errors.New("Empty file!")
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue