@@ -118,6 +118,7 @@ type PresignedURLOptions struct {
118118 Query * url.Values `xml:"-" url:"-" header:"-"`
119119 Header * http.Header `header:"-,omitempty" url:"-" xml:"-"`
120120 SignMerged bool `xml:"-" url:"-" header:"-"`
121+ AuthTime * AuthTime `xml:"-" url:"-" header:"-"`
121122}
122123
123124// GetPresignedURL get the object presigned to down or upload file by url
@@ -137,11 +138,20 @@ func (s *ObjectService) GetPresignedURL(ctx context.Context, httpMethod, name, a
137138 optQuery : opt ,
138139 optHeader : opt ,
139140 }
140- if popt , ok := opt .(* PresignedURLOptions ); ok {
141- if popt != nil && popt .Query != nil {
142- qs := popt .Query .Encode ()
143- if qs != "" {
144- sendOpt .uri = fmt .Sprintf ("%s?%s" , sendOpt .uri , qs )
141+ var authTime * AuthTime
142+ if opt != nil {
143+ if opt , ok := opt .(* presignedURLTestingOptions ); ok {
144+ authTime = opt .authTime
145+ }
146+ if popt , ok := opt .(* PresignedURLOptions ); ok {
147+ if popt .Query != nil {
148+ qs := popt .Query .Encode ()
149+ if qs != "" {
150+ sendOpt .uri = fmt .Sprintf ("%s?%s" , sendOpt .uri , qs )
151+ }
152+ }
153+ if popt .AuthTime != nil {
154+ authTime = popt .AuthTime
145155 }
146156 }
147157 }
@@ -150,12 +160,6 @@ func (s *ObjectService) GetPresignedURL(ctx context.Context, httpMethod, name, a
150160 return nil , err
151161 }
152162
153- var authTime * AuthTime
154- if opt != nil {
155- if opt , ok := opt .(* presignedURLTestingOptions ); ok {
156- authTime = opt .authTime
157- }
158- }
159163 if authTime == nil {
160164 authTime = NewAuthTime (expired )
161165 }
@@ -206,13 +210,22 @@ func (s *ObjectService) GetPresignedURL2(ctx context.Context, httpMethod, name s
206210 optQuery : opt ,
207211 optHeader : opt ,
208212 }
213+ var authTime * AuthTime
209214 mark := "?"
210- if popt , ok := opt .(* PresignedURLOptions ); ok {
211- if popt != nil && popt .Query != nil {
212- qs := popt .Query .Encode ()
213- if qs != "" {
214- sendOpt .uri = fmt .Sprintf ("%s?%s" , sendOpt .uri , qs )
215- mark = "&"
215+ if opt != nil {
216+ if opt , ok := opt .(* presignedURLTestingOptions ); ok {
217+ authTime = opt .authTime
218+ }
219+ if popt , ok := opt .(* PresignedURLOptions ); ok {
220+ if popt .Query != nil {
221+ qs := popt .Query .Encode ()
222+ if qs != "" {
223+ sendOpt .uri = fmt .Sprintf ("%s?%s" , sendOpt .uri , qs )
224+ mark = "&"
225+ }
226+ }
227+ if popt .AuthTime != nil {
228+ authTime = popt .AuthTime
216229 }
217230 }
218231 }
@@ -225,12 +238,6 @@ func (s *ObjectService) GetPresignedURL2(ctx context.Context, httpMethod, name s
225238 return nil , err
226239 }
227240
228- var authTime * AuthTime
229- if opt != nil {
230- if opt , ok := opt .(* presignedURLTestingOptions ); ok {
231- authTime = opt .authTime
232- }
233- }
234241 if authTime == nil {
235242 authTime = NewAuthTime (expired )
236243 }
0 commit comments