repochecker: Enforce archive types

This commit is contained in:
nemunaire 2021-11-13 16:30:45 +01:00
parent 038abe450d
commit 724b00b825
2 changed files with 7 additions and 1 deletions

View File

@ -127,6 +127,11 @@ func SyncExerciceFiles(i Importer, exercice fic.Exercice) (errs []string) {
// Import standard files
for _, fname := range files {
// Enforce file format
if path.Ext(fname) == "rar" || path.Ext(fname) == "7z" {
errs = append(errs, fmt.Sprintf("%q: WARNING %q use a forbidden archive type.", path.Base(exercice.Path), fname))
}
if f, err := i.importFile(path.Join(exercice.Path, "files", fname),
func(filePath string, origin string) (interface{}, error) {
return exercice.ImportFile(filePath, origin, digests[fname])

View File

@ -1,3 +1,4 @@
//go:build checkupdate
// +build checkupdate
package main
@ -9,7 +10,7 @@ import (
"net/http"
)
const version = 10
const version = 11
func init() {
go checkUpdate()