sync: Handle remote challenge files

This commit is contained in:
nemunaire 2023-10-13 16:05:15 +02:00
commit 1d4b79bf90
5 changed files with 126 additions and 30 deletions

View file

@ -234,7 +234,7 @@ func checkFileHash(filePath string, digest []byte) (dgst []byte, size int64, err
// ImportFile registers (ou updates if it already exists in database) the file in database.
func (e *Exercice) ImportFile(filePath string, origin string, digest []byte, digestshown []byte, disclaimer string, published bool) (interface{}, error) {
if result512, size, err := checkFileHash(filePath, digest); !OptionalDigest && err != nil {
return EFile{}, err
return nil, err
} else {
dPath := strings.TrimPrefix(filePath, FilesDir)
if f, err := e.GetFileByPath(dPath); err != nil {