From 41a186b05175972753f556095c194b35f50a63ef Mon Sep 17 00:00:00 2001 From: Xhofe Date: Sun, 17 Apr 2022 21:12:55 +0800 Subject: [PATCH 1/3] fix(native): set size of folder to 0 --- drivers/native/driver.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/native/driver.go b/drivers/native/driver.go index 9afaff84dd5..84f0c22b3de 100644 --- a/drivers/native/driver.go +++ b/drivers/native/driver.go @@ -103,7 +103,6 @@ func (driver Native) Files(path string, account *model.Account) ([]model.File, e time := f.ModTime() file := model.File{ Name: f.Name(), - Size: f.Size(), Type: 0, UpdatedAt: &time, Driver: driver.Config().Name, @@ -112,6 +111,7 @@ func (driver Native) Files(path string, account *model.Account) ([]model.File, e file.Type = conf.FOLDER } else { file.Type = utils.GetFileType(filepath.Ext(f.Name())) + file.Size = f.Size() } files = append(files, file) } From f9533440c760bc3b62b6e91e1db6c5fdc77507c5 Mon Sep 17 00:00:00 2001 From: Xhofe Date: Sun, 17 Apr 2022 22:50:28 +0800 Subject: [PATCH 2/3] build: cancel static link for glibc --- build.sh | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/build.sh b/build.sh index 31921ea87ce..5c82d13596e 100644 --- a/build.sh +++ b/build.sh @@ -51,16 +51,8 @@ BUILD() { gitTag=$(git describe --long --tags --dirty --always) webTag=$(wget -qO- -t1 -T2 "https://api.github.com/repos/alist-org/alist-web/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g') echo "build version: $gitTag" + ldflags="\ --w -s --extldflags '-static -fpic' \ --X 'github.com/Xhofe/alist/conf.BuiltAt=$builtAt' \ --X 'github.com/Xhofe/alist/conf.GoVersion=$goVersion' \ --X 'github.com/Xhofe/alist/conf.GitAuthor=$gitAuthor' \ --X 'github.com/Xhofe/alist/conf.GitCommit=$gitCommit' \ --X 'github.com/Xhofe/alist/conf.GitTag=$gitTag' \ --X 'github.com/Xhofe/alist/conf.WebTag=$webTag' \ -" - ldflagsDarwin="\ -w -s \ -X 'github.com/Xhofe/alist/conf.BuiltAt=$builtAt' \ -X 'github.com/Xhofe/alist/conf.GoVersion=$goVersion' \ @@ -70,11 +62,9 @@ BUILD() { -X 'github.com/Xhofe/alist/conf.WebTag=$webTag' \ " if [ "$1" == "release" ]; then - xgo -targets=linux/*,windows/* -out "$appName" -ldflags="$ldflags" -tags=jsoniter . - xgo -targets=darwin/* -out "$appName" -ldflags="$ldflagsDarwin" -tags=jsoniter . + xgo -out "$appName" -ldflags="$ldflags" -tags=jsoniter . else - xgo -targets=linux/amd64,windows/amd64 -out "$appName" -ldflags="$ldflags" -tags=jsoniter . - xgo -targets=darwin/amd64 -out "$appName" -ldflags="$ldflagsDarwin" -tags=jsoniter . + xgo -targets=linux/amd64,windows/amd64,darwin/amd64 -out "$appName" -ldflags="$ldflags" -tags=jsoniter . fi mkdir -p "build" mv alist-* build From d38f36ef44450653bf9e4af5692a74ed3417ba50 Mon Sep 17 00:00:00 2001 From: Xhofe Date: Sun, 17 Apr 2022 22:50:54 +0800 Subject: [PATCH 3/3] chore: delete useless test file --- alist_test.go | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 alist_test.go diff --git a/alist_test.go b/alist_test.go deleted file mode 100644 index ae4bb2fb474..00000000000 --- a/alist_test.go +++ /dev/null @@ -1,12 +0,0 @@ -package main - -import ( - "fmt" - "net/url" - "testing" -) - -func TestUrl(t *testing.T) { - s,_ := url.QueryUnescape("/ali/%E7%8C%AA%E5%A4%B4%E7%9A%84%E6%96%87%E4%BB%B6%5B%E5%98%BF%E5%98%BF%5D/%E9%82%B9%E9%82%B9%E7%9A%84%E6%96%87%E4%BB%B6/%E6%A1%8C%E9%9D%A2%E5%A3%81%E7%BA%B8/v2-e8f266ba17ae387eefed1cb22b2b5e4e_r.jpg") - fmt.Print(s) -} \ No newline at end of file