Skip to content

Commit

Permalink
alist: deny unsafe operations
Browse files Browse the repository at this point in the history
* When the user cache is not set properly, Clear the cache directory operation will be very dangerous
  • Loading branch information
sbwml committed Apr 28, 2022
1 parent 4afc3e7 commit 54cc241
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions alist/patches/0001-Revert-feat-clear-temp-file-while-start.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From fdcb81f6ba8b8d7546a6742e9566487e12815499 Mon Sep 17 00:00:00 2001
From: sbwml <admin@cooluc.com>
Date: Thu, 28 Apr 2022 11:10:53 +0800
Subject: [PATCH] Revert "feat: clear temp file while start"

This reverts commit 24d031d57875d3c6a9624fa7334c6eac1c9111fb.
---
bootstrap/conf.go | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/bootstrap/conf.go b/bootstrap/conf.go
index 5c9a1b3..f4d87d4 100644
--- a/bootstrap/conf.go
+++ b/bootstrap/conf.go
@@ -7,7 +7,6 @@ import (
log "github.com/sirupsen/logrus"
"io/ioutil"
"os"
- "path/filepath"
)

// InitConf init config
@@ -47,11 +46,7 @@ func InitConf() {
if !conf.Conf.Force {
confFromEnv()
}
- err := os.RemoveAll(filepath.Join(conf.Conf.TempDir))
- if err != nil {
- log.Errorln("failed delete temp file:", err)
- }
- err = os.MkdirAll(conf.Conf.TempDir, 0700)
+ err := os.MkdirAll(conf.Conf.TempDir, 0700)
if err != nil {
log.Fatalf("create temp dir error: %s", err.Error())
}
--
2.34.1

0 comments on commit 54cc241

Please sign in to comment.