admin: sync.ImportFile takes Importer as first arg

This commit is contained in:
nemunaire 2017-12-12 06:22:22 +01:00 committed by Pierre-Olivier Mercier
parent 9a9d5fcda4
commit 3d59042802
2 changed files with 9 additions and 5 deletions

View file

@ -131,7 +131,7 @@ func createExerciceHint(exercice fic.Exercice, body []byte) (interface{}, error)
if len(uh.Content) != 0 {
return exercice.AddHint(uh.Title, uh.Content, uh.Cost)
} else if len(uh.URI) != 0 {
return sync.ImportFile(uh.URI,
return sync.ImportFile(sync.GlobalImporter, uh.URI,
func(filePath string, origin string) (interface{}, error) {
return exercice.AddHint(uh.Title, "$FILES" + strings.TrimPrefix(filePath, fic.FilesDir), uh.Cost)
})
@ -221,7 +221,7 @@ func createExerciceFile(exercice fic.Exercice, body []byte) (interface{}, error)
return nil, err
}
return sync.ImportFile(uf.URI,
return sync.ImportFile(sync.GlobalImporter, uf.URI,
func(filePath string, origin string) (interface{}, error) {
if digest, err := hex.DecodeString(uf.Digest); err != nil {
return nil, err