@@ -70,14 +70,13 @@ func (g *GiteaBackend) Batch(_ string, pointers []transfer.BatchItem, args trans
70
70
g .logger .Log ("json marshal error" , err )
71
71
return nil , err
72
72
}
73
- url := g .server .JoinPath ("objects/batch" ).String ()
74
73
headers := map [string ]string {
75
74
headerAuthorization : g .authToken ,
76
75
headerGiteaInternalAuth : g .internalAuth ,
77
76
headerAccept : mimeGitLFS ,
78
77
headerContentType : mimeGitLFS ,
79
78
}
80
- req := newInternalRequestLFS (g .ctx , url , http .MethodPost , headers , bodyBytes )
79
+ req := newInternalRequestLFS (g .ctx , g . server . JoinPath ( "objects/batch" ). String () , http .MethodPost , headers , bodyBytes )
81
80
resp , err := req .Response ()
82
81
if err != nil {
83
82
g .logger .Log ("http request error" , err )
@@ -179,13 +178,12 @@ func (g *GiteaBackend) Download(oid string, args transfer.Args) (io.ReadCloser,
179
178
g .logger .Log ("argument id incorrect" )
180
179
return nil , 0 , transfer .ErrCorruptData
181
180
}
182
- url := action .Href
183
181
headers := map [string ]string {
184
182
headerAuthorization : g .authToken ,
185
183
headerGiteaInternalAuth : g .internalAuth ,
186
184
headerAccept : mimeOctetStream ,
187
185
}
188
- req := newInternalRequestLFS (g .ctx , url , http .MethodGet , headers , nil )
186
+ req := newInternalRequestLFS (g .ctx , toInternalLFSURL ( action . Href ) , http .MethodGet , headers , nil )
189
187
resp , err := req .Response ()
190
188
if err != nil {
191
189
return nil , 0 , fmt .Errorf ("failed to get response: %w" , err )
@@ -225,15 +223,14 @@ func (g *GiteaBackend) Upload(oid string, size int64, r io.Reader, args transfer
225
223
g .logger .Log ("argument id incorrect" )
226
224
return transfer .ErrCorruptData
227
225
}
228
- url := action .Href
229
226
headers := map [string ]string {
230
227
headerAuthorization : g .authToken ,
231
228
headerGiteaInternalAuth : g .internalAuth ,
232
229
headerContentType : mimeOctetStream ,
233
230
headerContentLength : strconv .FormatInt (size , 10 ),
234
231
}
235
232
236
- req := newInternalRequestLFS (g .ctx , url , http .MethodPut , headers , nil )
233
+ req := newInternalRequestLFS (g .ctx , toInternalLFSURL ( action . Href ) , http .MethodPut , headers , nil )
237
234
req .Body (r )
238
235
resp , err := req .Response ()
239
236
if err != nil {
@@ -274,14 +271,13 @@ func (g *GiteaBackend) Verify(oid string, size int64, args transfer.Args) (trans
274
271
// the server sent no verify action
275
272
return transfer .SuccessStatus (), nil
276
273
}
277
- url := action .Href
278
274
headers := map [string ]string {
279
275
headerAuthorization : g .authToken ,
280
276
headerGiteaInternalAuth : g .internalAuth ,
281
277
headerAccept : mimeGitLFS ,
282
278
headerContentType : mimeGitLFS ,
283
279
}
284
- req := newInternalRequestLFS (g .ctx , url , http .MethodPost , headers , bodyBytes )
280
+ req := newInternalRequestLFS (g .ctx , toInternalLFSURL ( action . Href ) , http .MethodPost , headers , bodyBytes )
285
281
resp , err := req .Response ()
286
282
if err != nil {
287
283
return transfer .NewStatus (transfer .StatusInternalServerError ), err
0 commit comments