Kaynağa Gözat

Fixed the isHidden bug in file system and name this bug after Alanyeung to The Alanyeung Hidden Folder Bug

TC pushbot 5 4 yıl önce
ebeveyn
işleme
4f934e6f4a
2 değiştirilmiş dosya ile 22 ekleme ve 11 silme
  1. 3 3
      auth.go
  2. 19 8
      mod/filesystem/fileOpr.go

+ 3 - 3
auth.go

@@ -19,10 +19,10 @@ func AuthInit() {
 			rand.Read(key)
 			newSessionKey := string(key)
 			sysdb.Write("auth", "sessionkey", newSessionKey)
-
-			log.Println("Authentication session key loaded from database")
-		} else {
 			log.Println("New authentication session key generated")
+		} else {
+			log.Println("Authentication session key loaded from database")
+
 		}
 		skeyString := ""
 		sysdb.Read("auth", "sessionkey", &skeyString)

+ 19 - 8
mod/filesystem/fileOpr.go

@@ -24,6 +24,8 @@ import (
 	"strings"
 	"time"
 
+	"imuslab.com/arozos/mod/filesystem/hidden"
+
 	archiver "github.com/mholt/archiver/v3"
 )
 
@@ -346,15 +348,24 @@ func ArozZipFile(filelist []string, outputfile string, includeTopLevelFolder boo
 }
 
 func insideHiddenFolder(path string) bool {
-	thisPathInfo := filepath.ToSlash(filepath.Clean(path))
-	pathData := strings.Split(thisPathInfo, "/")
-	for _, thispd := range pathData {
-		if len(thispd) > 0 && thispd[:1] == "." {
-			//This path contain one of the folder is hidden
-			return true
-		}
+	FileIsHidden, err := hidden.IsHidden(path, true)
+	if err != nil {
+		//Read error. Maybe permission issue, assuem is hidden
+		return true
 	}
-	return false
+	return FileIsHidden
+
+	/*
+		thisPathInfo := filepath.ToSlash(filepath.Clean(path))
+		pathData := strings.Split(thisPathInfo, "/")
+		for _, thispd := range pathData {
+			if len(thispd) > 0 && thispd[:1] == "." {
+				//This path contain one of the folder is hidden
+				return true
+			}
+		}
+		return false
+	*/
 }
 
 func ViewZipFile(filepath string) ([]string, error) {