Skip to content

Commit ac19264

Browse files
YangSen-qnYangSen-qn
andauthored
fix: fput specified domain name is invalid (#423)
* fix: listbucket handle invalid time --------- Co-authored-by: YangSen-qn <[email protected]>
1 parent b0b0486 commit ac19264

File tree

11 files changed

+54
-59
lines changed

11 files changed

+54
-59
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 2.16.1
2+
## 修复
3+
1. 修复 fput 指定域名不生效问题
4+
15
# 2.16.0
26
## 新增
37
1. create-share / share-ls / share-cp 命令支持创建对文件夹的共享,列举和下载

README.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,7 @@ qshell 是利用 [七牛文档上公开的 API](http://developer.qiniu.com) 实
1717

1818
> 更新日志 [查看](CHANGELOG.md)
1919
20-
| 支持平台 | 链接 |
21-
| ----------------------- | -------------------------------------------------------------------------------------------------- |
22-
| Windows X86 | [下载](https://github.com/qiniu/qshell/releases/download/v2.13.0/qshell-v2.13.0-windows-386.zip) |
23-
| Windows amd64 | [下载](https://github.com/qiniu/qshell/releases/download/v2.13.0/qshell-v2.13.0-windows-amd64.zip) |
24-
| Windows arm | [下载](https://github.com/qiniu/qshell/releases/download/v2.13.0/qshell-v2.13.0-windows-arm.zip) |
25-
| Linux X86 | [下载](https://github.com/qiniu/qshell/releases/download/v2.13.0/qshell-v2.13.0-linux-386.tar.gz) |
26-
| Linux amd64 | [下载](https://github.com/qiniu/qshell/releases/download/v2.13.0/qshell-v2.13.0-linux-amd64.tar.gz) |
27-
| Linux arm | [下载](https://github.com/qiniu/qshell/releases/download/v2.13.0/qshell-v2.13.0-linux-arm.tar.gz) |
28-
| Linux arm64 | [下载](https://github.com/qiniu/qshell/releases/download/v2.13.0/qshell-v2.13.0-linux-arm64.tar.gz) |
29-
| Mac OS(10.12以上) amd64 | [下载](https://github.com/qiniu/qshell/releases/download/v2.13.0/qshell-v2.13.0-darwin-amd64.tar.gz) |
30-
| Mac OS arm64 | [下载](https://github.com/qiniu/qshell/releases/download/v2.13.0/qshell-v2.13.0-darwin-arm64.tar.gz) |
31-
20+
[下载地址](https://github.com/qiniu/qshell/releases)
3221

3322
## 安装
3423

cmd_test/bucket_mk_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
package cmd
44

55
import (
6-
"github.com/qiniu/qshell/v2/cmd_test/test"
76
"strings"
87
"testing"
8+
9+
"github.com/qiniu/qshell/v2/cmd_test/test"
910
)
1011

1112
func TestMkBucket(t *testing.T) {
@@ -15,7 +16,7 @@ func TestMkBucket(t *testing.T) {
1516
t.Fatal("should return bucket exists")
1617
}
1718

18-
if !strings.Contains(errs, "error:the bucket already exists") {
19+
if !strings.Contains(errs, "the bucket already exists") {
1920
t.Fatal("expected error:bucket exists, but:" + errs)
2021
}
2122

@@ -29,8 +30,8 @@ func TestMkBucketNotExistRegion(t *testing.T) {
2930
t.Fatal("should return bucket exists")
3031
}
3132

32-
if !strings.Contains(errs, "error:invalid region parameter") {
33-
t.Fatal("expected error:error:invalid region parameter, but:" + errs)
33+
if !strings.Contains(errs, "invalid region parameter") {
34+
t.Fatal("expected error:invalid region parameter, but:" + errs)
3435
}
3536

3637
return

cmd_test/upload_form_test.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,6 @@ func TestFormUploadWithUploadHost(t *testing.T) {
8787
if !strings.Contains(result, "MimeType: image/jpg") {
8888
t.Fatal(result)
8989
}
90-
91-
path, err = test.CreateTempFile(1*1024 + 1)
92-
if err != nil {
93-
t.Fatal("create form upload file error:", err)
94-
}
9590
}
9691

9792
func TestFormUploadWithWrongUploadHost(t *testing.T) {

go.mod

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ require (
55
github.com/astaxie/beego v1.12.3
66
github.com/aws/aws-sdk-go v1.37.31
77
github.com/mitchellh/go-homedir v1.1.0
8-
github.com/qiniu/go-sdk/v7 v7.24.0
8+
github.com/qiniu/go-sdk/v7 v7.25.4
99
github.com/schollz/progressbar/v3 v3.8.6
1010
github.com/spf13/cast v1.3.1
1111
github.com/spf13/cobra v1.1.3
@@ -20,19 +20,14 @@ require (
2020
github.com/Masterminds/goutils v1.1.1 // indirect
2121
github.com/Masterminds/semver/v3 v3.1.1 // indirect
2222
github.com/alex-ant/gomath v0.0.0-20160516115720-89013a210a82 // indirect
23-
github.com/elastic/go-sysinfo v1.15.0 // indirect
24-
github.com/elastic/go-windows v1.0.0 // indirect
2523
github.com/gammazero/toposort v0.1.1 // indirect
2624
github.com/gofrs/flock v0.8.1 // indirect
2725
github.com/google/uuid v1.1.1 // indirect
2826
github.com/huandu/xstrings v1.3.1 // indirect
2927
github.com/imdario/mergo v0.3.11 // indirect
3028
github.com/mitchellh/copystructure v1.0.0 // indirect
3129
github.com/mitchellh/reflectwalk v1.0.0 // indirect
32-
github.com/pkg/errors v0.9.1 // indirect
33-
github.com/prometheus/procfs v0.15.1 // indirect
3430
github.com/shopspring/decimal v1.2.0 // indirect
35-
howett.net/plist v0.0.0-20181124034731-591f970eefbb // indirect
3631
modernc.org/fileutil v1.3.0 // indirect
3732
)
3833

@@ -68,5 +63,6 @@ require (
6863
gopkg.in/yaml.v3 v3.0.0 // indirect
6964
)
7065

71-
go 1.21
66+
go 1.23.0
67+
7268
toolchain go1.24.1

go.sum

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm
7474
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
7575
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
7676
github.com/elastic/go-elasticsearch/v6 v6.8.5/go.mod h1:UwaDJsD3rWLM5rKNFzv9hgox93HoX8utj1kxD9aFUcI=
77-
github.com/elastic/go-sysinfo v1.0.2/go.mod h1:O/D5m1VpYLwGjCYzEt63g3Z1uO3jXfwyzzjiW90t8cY=
78-
github.com/elastic/go-sysinfo v1.15.0 h1:54pRFlAYUlVNQ2HbXzLVZlV+fxS7Eax49stzg95M4Xw=
79-
github.com/elastic/go-sysinfo v1.15.0/go.mod h1:jPSuTgXG+dhhh0GKIyI2Cso+w5lPJ5PvVqKlL8LV/Hk=
80-
github.com/elastic/go-windows v1.0.0 h1:qLURgZFkkrYyTTkvYpsZIgf83AUsdIHfvlJaqaZ7aSY=
81-
github.com/elastic/go-windows v1.0.0/go.mod h1:TsU0Nrp7/y3+VwE82FoZF8gC/XFg/Elz6CcloAxnPgU=
8277
github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
8378
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
8479
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
@@ -131,8 +126,6 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a
131126
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
132127
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
133128
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
134-
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
135-
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
136129
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
137130
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
138131
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
@@ -186,7 +179,6 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y
186179
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
187180
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
188181
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
189-
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901/go.mod h1:Z86h9688Y0wesXCyonoVr47MasHilkuLMqGhRZ4Hpak=
190182
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
191183
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
192184
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
@@ -263,7 +255,6 @@ github.com/peterh/liner v1.0.1-0.20171122030339-3681c2a91233/go.mod h1:xIteQHvHu
263255
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
264256
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
265257
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
266-
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
267258
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
268259
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
269260
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@@ -281,16 +272,13 @@ github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8
281272
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
282273
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
283274
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
284-
github.com/prometheus/procfs v0.0.0-20190425082905-87a4384529e0/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
285275
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
286276
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
287277
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
288-
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
289-
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
290278
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
291279
github.com/qiniu/dyn v1.3.0/go.mod h1:E8oERcm8TtwJiZvkQPbcAh0RL8jO1G0VXJMW3FAWdkk=
292-
github.com/qiniu/go-sdk/v7 v7.24.0 h1:1Vq8Xb1GrwqpeLp1HAnKv6xi0d9GyyiAapJb5/X2na8=
293-
github.com/qiniu/go-sdk/v7 v7.24.0/go.mod h1:uZE85Pi0ftIHT/UNLShosdzwsovqpdas0LwAGO7cPao=
280+
github.com/qiniu/go-sdk/v7 v7.25.4 h1:ulCKlTEyrZzmNytXweOrnva49+Q4+ASjYBCSXhkRWTo=
281+
github.com/qiniu/go-sdk/v7 v7.25.4/go.mod h1:dmKtJ2ahhPWFVi9o1D5GemmWoh/ctuB9peqTowyTO8o=
294282
github.com/qiniu/x v1.10.5/go.mod h1:03Ni9tj+N2h2aKnAz+6N0Xfl8FwMEDRC2PAlxekASDs=
295283
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
296284
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
@@ -440,7 +428,6 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
440428
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
441429
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
442430
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
443-
golang.org/x/sys v0.0.0-20190425145619-16072639606e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
444431
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
445432
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
446433
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -553,8 +540,6 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh
553540
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
554541
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
555542
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
556-
howett.net/plist v0.0.0-20181124034731-591f970eefbb h1:jhnBjNi9UFpfpl8YZhA9CrOqpnJdvzuiHsl/dnxl11M=
557-
howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0=
558543
modernc.org/fileutil v1.0.0/go.mod h1:JHsWpkrk/CnVV1H/eGlFf85BEpfkrp56ro8nojIq9Q8=
559544
modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE=
560545
modernc.org/fileutil v1.3.0/go.mod h1:XatxS8fZi3pS8/hKG2GH/ArUogfxjpEKs3Ku3aK4JyQ=

iqshell/common/flow/flow.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,26 +104,32 @@ func (f *Flow) Start() {
104104
workList := make([]*WorkInfo, 0, f.doWorkInfoListCount)
105105
for {
106106
hasMore, workInfo, err := f.WorkProvider.Provide()
107+
log.DebugF("work producer get work, hasMore:%v, workInfo: %+v, err: %+v", hasMore, workInfo, err)
107108
if err != nil {
108109
if err.Code == data.ErrorCodeParamMissing ||
109110
err.Code == data.ErrorCodeLineHeader {
111+
log.DebugF("work producer get work, skip:%s because:%s", workInfo, err)
110112
f.notifyWorkSkip(workInfo, nil, err)
111113
} else {
114+
log.DebugF("work producer get work fail, error:%s info:%s", err, workInfo)
112115
f.notifyWorkFail(workInfo, err)
113116
}
114117
continue
115118
}
116119

117120
if workInfo == nil || workInfo.Work == nil {
118121
if !hasMore {
122+
log.Debug("work producer get work completed")
119123
break
120124
} else {
125+
log.Info("work producer get work fail: work in empty")
121126
continue
122127
}
123128
}
124129

125130
// 检测 work 是否需要过
126131
if skip, cause := f.shouldWorkSkip(workInfo); skip {
132+
log.DebugF("work producer get work, skip:%s cause:%s", workInfo.Data, cause)
127133
f.notifyWorkSkip(workInfo, nil, cause)
128134
continue
129135
}
@@ -192,11 +198,15 @@ func (f *Flow) Start() {
192198

193199
workCount := len(workList)
194200

201+
log.DebugF("work consumer get works, count:%d", workCount)
202+
195203
_ = f.limitAcquire(workCount)
196204
// workRecordList 有数据则长度和 workList 长度相同
197205
workRecordList, workErr := worker.DoWork(workList)
198206
f.limitRelease(workCount)
199207

208+
log.DebugF("work consumer handle works, count:%d error:%+v", workCount, workErr)
209+
200210
if len(workRecordList) == 0 && workErr != nil {
201211
log.ErrorF("Do Worker Error:%+v", workErr)
202212
for _, workInfo := range workList {

iqshell/common/utils/user_agent.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ package utils
22

33
import (
44
"fmt"
5-
"github.com/qiniu/qshell/v2/iqshell/common/version"
65
"runtime"
6+
7+
"github.com/qiniu/qshell/v2/iqshell/common/version"
78
)
89

910
// 生成客户端代理名称
1011
func UserAgent() string {
11-
return fmt.Sprintf("QShell/%s (%s; %s; %s)", version.Version(), runtime.GOOS, runtime.GOARCH, runtime.Version())
12+
return fmt.Sprintf("QiniuQShell/%s (%s; %s; %s)", version.Version(), runtime.GOOS, runtime.GOARCH, runtime.Version())
1213
}

iqshell/storage/bucket/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func List(info ListApiInfo,
8585
}
8686

8787
info.init()
88-
log.DebugF("will list bucket:%s, suffixes:%s, prefix:%s", info.Bucket, info.Suffixes, info.Prefix)
88+
log.DebugF("will list bucket:%s, suffixes:%s, prefix:%s start:%s end:%s", info.Bucket, info.Suffixes, info.Prefix, info.StartTime, info.EndTime)
8989
shouldCheckPutTime := !info.StartTime.IsZero() || !info.EndTime.IsZero()
9090
shouldCheckSuffixes := len(info.Suffixes) > 0
9191
shouldCheckFileTypes := len(info.FileTypes) > 0

iqshell/storage/bucket/operations/list.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,20 @@ func parseDate(dateString string) (time.Time, *data.CodeError) {
178178
return time.Time{}, data.NewEmptyError().AppendDescF("date format must be year-month-day-hour-minute-second")
179179
}
180180

181-
var dateItems [6]int
182-
for ind, field := range fields {
183-
field, err := strconv.Atoi(field)
184-
if err != nil {
185-
return time.Time{}, data.NewEmptyError().AppendDescF("date format must be year-month-day-hour-minute-second, each field must be integer")
186-
}
187-
dateItems[ind] = field
181+
layouts := []string{
182+
"2006",
183+
"2006-01",
184+
"2006-01-02",
185+
"2006-01-02-15",
186+
"2006-01-02-15-04",
187+
"2006-01-02-15-04-05",
188+
}
189+
layout := layouts[len(fields)-1]
190+
date, err := time.ParseInLocation(layout, dateString, time.Local)
191+
if err != nil {
192+
return time.Time{}, data.NewEmptyError().AppendDescF("date format invalid:%s parse date error:%s", dateString, err)
188193
}
189-
return time.Date(dateItems[0], time.Month(dateItems[1]), dateItems[2], dateItems[3], dateItems[4], dateItems[5], 0, time.Local), nil
194+
return date, nil
190195
}
191196

192197
func (info *ListInfo) getStartDate() (time.Time, *data.CodeError) {

iqshell/storage/object/download/operations/work_provider.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ func (w *workProvider) getWorkInfoFromFile() {
103103
var keys []string
104104
for {
105105
if len(keys) == 300 {
106-
w.getWorkInfoOfKeys(keys)
106+
if !w.getWorkInfoOfKeys(keys) {
107+
break
108+
}
107109
keys = nil
108110
}
109111

@@ -140,9 +142,9 @@ func (w *workProvider) getWorkInfoFromFile() {
140142
}()
141143
}
142144

143-
func (w *workProvider) getWorkInfoOfKeys(keys []string) {
145+
func (w *workProvider) getWorkInfoOfKeys(keys []string) bool {
144146
if len(keys) == 0 {
145-
return
147+
return true
146148
}
147149

148150
operations := make([]batch.Operation, 0, len(keys))
@@ -155,6 +157,11 @@ func (w *workProvider) getWorkInfoOfKeys(keys []string) {
155157
}
156158
}
157159

160+
if len(operations) == 0 {
161+
log.Error("get file info error: no valid key found")
162+
return false
163+
}
164+
158165
results, err := batch.Some(operations)
159166
if len(results) == len(operations) {
160167
for i, result := range results {
@@ -203,6 +210,8 @@ func (w *workProvider) getWorkInfoOfKeys(keys []string) {
203210
}
204211
time.Sleep(10 * time.Second)
205212
}
213+
214+
return true
206215
}
207216

208217
func (w *workProvider) getWorkInfoFromBucket() {

0 commit comments

Comments
 (0)