Skip to content

Commit

Permalink
fix: some missing regexp lib modified
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Jan 1, 2024
1 parent 478470f commit 57bac9e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions server/common/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package common

import (
"path"
"regexp"
"strings"

"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/internal/driver"
"github.com/alist-org/alist/v3/internal/model"
"github.com/alist-org/alist/v3/internal/op"
"github.com/alist-org/alist/v3/pkg/utils"
"github.com/dlclark/regexp2"
)

func IsStorageSignEnabled(rawPath string) bool {
Expand All @@ -36,8 +36,8 @@ func CanAccess(user *model.User, meta *model.Meta, reqPath string, password stri
if meta != nil && !user.CanSeeHides() && meta.Hide != "" &&
IsApply(meta.Path, path.Dir(reqPath), meta.HSub) { // the meta should apply to the parent of current path
for _, hide := range strings.Split(meta.Hide, "\n") {
re := regexp.MustCompile(hide)
if re.MatchString(path.Base(reqPath)) {
re := regexp2.MustCompile(hide, regexp2.None)
if isMatch, _ := re.MatchString(path.Base(reqPath)); isMatch {
return false
}
}
Expand Down
4 changes: 2 additions & 2 deletions server/handles/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package handles

import (
"fmt"
"regexp"
"strconv"
"strings"

"github.com/alist-org/alist/v3/internal/model"
"github.com/alist-org/alist/v3/internal/op"
"github.com/alist-org/alist/v3/server/common"
"github.com/dlclark/regexp2"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
)
Expand Down Expand Up @@ -71,7 +71,7 @@ func UpdateMeta(c *gin.Context) {
func validHide(hide string) (string, error) {
rs := strings.Split(hide, "\n")
for _, r := range rs {
_, err := regexp.Compile(r)
_, err := regexp2.Compile(r, regexp2.None)
if err != nil {
return r, err
}
Expand Down

0 comments on commit 57bac9e

Please sign in to comment.