package main import ( "fmt" "path" "strings" "srs.epita.fr/fic-server/admin/sync" "srs.epita.fr/fic-server/libfic" ) func EPITACheckFile(file *fic.EFile, exceptions *sync.CheckExceptions) (errs []error) { // Enforce file format if path.Ext(file.Name) == "rar" || path.Ext(file.Name) == "7z" { errs = append(errs, fmt.Errorf("this file use a forbidden archive type.")) } // Check .gz files have a dedicated hash if path.Ext(file.Name) == ".gz" && !strings.HasSuffix(file.Name, ".tar.gz") && len(file.ChecksumShown) == 0 { errs = append(errs, fmt.Errorf("digest of original, uncompressed, file missing in DIGESTS.txt")) } return }