package main import ( "log" "path/filepath" "strings" "srs.epita.fr/fic-server/admin/sync" "srs.epita.fr/fic-server/libfic" ) func InspectFile(file *fic.EFile, exceptions *sync.CheckExceptions) (errs []error) { i, ok := sync.GlobalImporter.(sync.LocalImporter) if !ok { log.Printf("Unable to load `file-inspector.so` as the current Importer is not a LocalImporter (%T).", sync.GlobalImporter) return } path := i.GetLocalPath(file.GetOrigin()) if filepath.Ext(file.Name) == ".tar" || strings.HasSuffix(file.Name, ".tar.gz") || strings.HasSuffix(file.Name, ".tar.bz2") { // Check there is more than 1 file in tarball errs = append(errs, checkTarball(path, file, exceptions)...) } else if filepath.Ext(file.Name) == ".zip" { // Check there is more than 1 file in zip errs = append(errs, checkZip(path, file, exceptions)...) } return }