Destruction sécurisée de fichier implémentée
This commit is contained in:
@@ -4,9 +4,9 @@ import (
|
||||
"StoreBackEnd/pkg/protocol"
|
||||
"StoreBackEnd/pkg/protocol/repository"
|
||||
"StoreBackEnd/pkg/protocol/rules/writers"
|
||||
"StoreBackEnd/pkg/utils"
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
// EraseFileRulePrefix Identifiant de cette règle
|
||||
@@ -43,8 +43,9 @@ func (rule EraseFileRule) Execute(data string) (*protocol.ProtocolWriterResult,
|
||||
if rule.Match(data) {
|
||||
values := rule.matcher.Parse(data)
|
||||
|
||||
errRemoveFile := os.Remove(fmt.Sprintf("%s/%s", rule.storagePath, values[1]))
|
||||
if errRemoveFile != nil {
|
||||
//errRemoveFile := os.Remove(fmt.Sprintf("%s/%s", rule.storagePath, values[1]))
|
||||
hasRemoveFile := utils.DeleteFile(fmt.Sprintf("%s\\%s", rule.storagePath, values[1]), 10)
|
||||
if !hasRemoveFile {
|
||||
return rule.protocolRepo.ExecuteWriter(writers.EraseErrorRulePrefix), nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user