Skip to content

Commit 19e4b31

Browse files
update FullName method to show group id if it's non-zero
1 parent 69d9176 commit 19e4b31

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+344
-344
lines changed

models/repo/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ func (repo *Repository) LoadAttributes(ctx context.Context) error {
369369

370370
// FullName returns the repository full name
371371
func (repo *Repository) FullName() string {
372-
return repo.OwnerName + "/" + repo.Name
372+
return repo.OwnerName + "/" + groupSegmentWithTrailingSlash(repo.GroupID) + repo.Name
373373
}
374374

375375
// HTMLURL returns the repository HTML URL

modules/csv/csv_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ a,"quoted ""text"" with
256256
new lines
257257
in second column",c`,
258258
expectedText: `col1,col2,col3
259-
a,,c`,
259+
a,c`,
260260
},
261261
// case 2 - quoted text with escaped quotes in last column
262262
{
@@ -276,9 +276,9 @@ a,bb,c,d,ee ,"f
276276
f"
277277
a,b,"c ""
278278
c",d,e,f`,
279-
expectedText: `a,,c,d,,f
279+
expectedText: `a,c,d,f
280280
a,bb,c,d,ee ,
281-
a,b,,d,e,f`,
281+
a,b,d,e,f`,
282282
},
283283
// case 4 - csv with pipes and quotes
284284
{
@@ -391,17 +391,17 @@ f" | 4.56 | 789`,
391391
// In the previous bestScore algorithm, this would have picked comma as the delimiter, but now it should guess tab
392392
{
393393
csv: `c1 c2 c3 c4 c5 c6
394-
v,k,x,v ym,f,oa,qn,uqijh,n,s,wvygpo uj,kt,j,w,i,fvv,tm,f,ddt,b,mwt,e,t,teq,rd,p,a e,wfuae,t,h,q,im,ix,y h,mrlu,l,dz,ff,zi,af,emh ,gov,bmfelvb,axp,f,u,i,cni,x,z,v,sh,w,jo,,m,h
395-
k,ohf,pgr,tde,m,s te,ek,,v,,ic,kqc,dv,w,oi,j,w,gojjr,ug,,l,j,zl g,qziq,bcajx,zfow,ka,j,re,ohbc k,nzm,qm,ts,auf th,elb,lx,l,q,e,qf asbr,z,k,y,tltobga
396-
g,m,bu,el h,l,jwi,o,wge,fy,rure,c,g,lcxu,fxte,uns,cl,s,o,t,h,rsoy,f bq,s,uov,z,ikkhgyg,,sabs,c,hzue mc,b,,j,t,n sp,mn,,m,t,dysi,eq,pigb,rfa,z w,rfli,sg,,o,wjjjf,f,wxdzfk,x,t,p,zy,p,mg,r,l,h
397-
e,ewbkc,nugd,jj,sf,ih,i,n,jo,b,poem,kw,q,i,x,t,e,uug,k j,xm,sch,ux,h,,fb,f,pq,,mh,,f,v,,oba,w,h,v,eiz,yzd,o,a,c,e,dhp,q a,pbef,epc,k,rdpuw,cw k,j,e,d xf,dz,sviv,w,sqnzew,t,b v,yg,f,cq,ti,g,m,ta,hm,ym,ii,hxy,p,z,r,e,ga,sfs,r,p,l,aar,w,kox,j
394+
v,k,x,v ym,f,oa,qn,uqijh,n,s,wvygpo uj,kt,j,w,i,fvv,tm,f,ddt,b,mwt,e,t,teq,rd,p,a e,wfuae,t,h,q,im,ix,y h,mrlu,l,dz,ff,zi,af,emh ,gov,bmfelvb,axp,f,u,i,cni,x,z,v,sh,w,jo,m,h
395+
k,ohf,pgr,tde,m,s te,ek,v,ic,kqc,dv,w,oi,j,w,gojjr,ug,l,j,zl g,qziq,bcajx,zfow,ka,j,re,ohbc k,nzm,qm,ts,auf th,elb,lx,l,q,e,qf asbr,z,k,y,tltobga
396+
g,m,bu,el h,l,jwi,o,wge,fy,rure,c,g,lcxu,fxte,uns,cl,s,o,t,h,rsoy,f bq,s,uov,z,ikkhgyg,sabs,c,hzue mc,b,j,t,n sp,mn,m,t,dysi,eq,pigb,rfa,z w,rfli,sg,o,wjjjf,f,wxdzfk,x,t,p,zy,p,mg,r,l,h
397+
e,ewbkc,nugd,jj,sf,ih,i,n,jo,b,poem,kw,q,i,x,t,e,uug,k j,xm,sch,ux,h,fb,f,pq,mh,f,v,oba,w,h,v,eiz,yzd,o,a,c,e,dhp,q a,pbef,epc,k,rdpuw,cw k,j,e,d xf,dz,sviv,w,sqnzew,t,b v,yg,f,cq,ti,g,m,ta,hm,ym,ii,hxy,p,z,r,e,ga,sfs,r,p,l,aar,w,kox,j
398398
l,d,v,pp,q,j,bxip,w,i,im,qa,o e,o h,w,a,a,qzj,nt,qfn,ut,fvhu,ts hu,q,g,p,q,ofpje,fsqa,frp,p,vih,j,w,k,jx, ln,th,ka,l,b,vgk,rv,hkx rj,v,y,cwm,rao,e,l,wvr,ptc,lm,yg,u,k,i,b,zk,b,gv,fls
399399
velxtnhlyuysbnlchosqlhkozkdapjaueexjwrndwb nglvnv kqiv pbshwlmcexdzipopxjyrxhvjalwp pydvipwlkkpdvbtepahskwuornbsb qwbacgq
400-
l,y,u,bf,y,m,eals,n,cop,h,g,vs,jga,opt x,b,zwmn,hh,b,n,pdj,t,d px yn,vtd,u,y,b,ps,yo,qqnem,mxg,m,al,rd,c,k,d,q,f ilxdxa,m,y,,p,p,y,prgmg,q,n,etj,k,ns b,pl,z,jq,hk
401-
p,gc jn,mzr,bw sb,e,r,dy,ur,wzy,r,c,n,yglr,jbdu,r,pqk,k q,d,,,p,l,euhl,dc,rwh,t,tq,z,h,p,s,t,x,fugr,h wi,zxb,jcig,o,t,k mfh,ym,h,e,p,cnvx,uv,zx,x,pq,blt,v,r,u,tr,g,g,xt
402-
nri,p,,t,if,,y,ptlqq a,i w,ovli,um,w,f,re,k,sb,w,jy,zf i,g,p,q,mii,nr,jm,cc i,szl,k,eg,l,d ,ah,w,b,vh
403-
,,sh,wx,mn,xm,u,d,yy,u,t,m,j,s,b ogadq,g,y,y,i,h,ln,jda,g,cz,s,rv,r,s,s,le,r, y,nu,f,nagj o,h,,adfy,o,nf,ns,gvsvnub,k,b,xyz v,h,g,ef,y,gb c,x,cw,x,go,h,t,x,cu,u,qgrqzrcmn,kq,cd,g,rejp,zcq
404-
skxg,t,vay,d,wug,d,xg,sexc rt g,ag,mjq,fjnyji,iwa,m,ml,b,ua,b,qjxeoc be,s,sh,n,jbzxs,g,n,i,h,y,r,be,mfo,u,p cw,r,,u,zn,eg,r,yac,m,l,edkr,ha,x,g,b,c,tg,c j,ye,u,ejd,maj,ea,bm,u,iy`,
400+
l,y,u,bf,y,m,eals,n,cop,h,g,vs,jga,opt x,b,zwmn,hh,b,n,pdj,t,d px yn,vtd,u,y,b,ps,yo,qqnem,mxg,m,al,rd,c,k,d,q,f ilxdxa,m,y,p,p,y,prgmg,q,n,etj,k,ns b,pl,z,jq,hk
401+
p,gc jn,mzr,bw sb,e,r,dy,ur,wzy,r,c,n,yglr,jbdu,r,pqk,k q,d,,p,l,euhl,dc,rwh,t,tq,z,h,p,s,t,x,fugr,h wi,zxb,jcig,o,t,k mfh,ym,h,e,p,cnvx,uv,zx,x,pq,blt,v,r,u,tr,g,g,xt
402+
nri,p,t,if,y,ptlqq a,i w,ovli,um,w,f,re,k,sb,w,jy,zf i,g,p,q,mii,nr,jm,cc i,szl,k,eg,l,d ,ah,w,b,vh
403+
,sh,wx,mn,xm,u,d,yy,u,t,m,j,s,b ogadq,g,y,y,i,h,ln,jda,g,cz,s,rv,r,s,s,le,r, y,nu,f,nagj o,h,adfy,o,nf,ns,gvsvnub,k,b,xyz v,h,g,ef,y,gb c,x,cw,x,go,h,t,x,cu,u,qgrqzrcmn,kq,cd,g,rejp,zcq
404+
skxg,t,vay,d,wug,d,xg,sexc rt g,ag,mjq,fjnyji,iwa,m,ml,b,ua,b,qjxeoc be,s,sh,n,jbzxs,g,n,i,h,y,r,be,mfo,u,p cw,r,u,zn,eg,r,yac,m,l,edkr,ha,x,g,b,c,tg,c j,ye,u,ejd,maj,ea,bm,u,iy`,
405405
expectedDelimiter: '\t',
406406
},
407407
// case 13 - a CSV with more than 10 lines and since we only use the first 10 lines, it should still get the delimiter as semicolon

modules/indexer/code/elasticsearch/elasticsearch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ func convertResult(searchResult *elastic.SearchResult, kw string, pageSize int)
316316
// <em> and </em> tags? If elastic search has handled that?
317317
startIndex, endIndex = contentMatchIndexPos(c[0], "<em>", "</em>")
318318
if startIndex == -1 {
319-
panic(fmt.Sprintf("1===%s,,,%#v,,,%s", kw, hit.Highlight, c[0]))
319+
panic(fmt.Sprintf("1===%s,,%#v,,%s", kw, hit.Highlight, c[0]))
320320
}
321321
} else {
322322
panic(fmt.Sprintf("2===%#v", hit.Highlight))

modules/issue/template/template_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ body:
662662
name: Name
663663
title: Title
664664
about: About
665-
labels: label1,label2,,label3 ,,
665+
labels: label1,label2,label3 ,
666666
ref: Ref
667667
body:
668668
- type: markdown
@@ -731,7 +731,7 @@ body:
731731
name: Name
732732
title: Title
733733
about: About
734-
labels: label1,label2,,label3 ,,
734+
labels: label1,label2,label3 ,
735735
ref: Ref
736736
---
737737
Content

routers/api/v1/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func repoAssignment() func(ctx *context.APIContext) {
147147
if group != "" {
148148
gid, _ = strconv.ParseInt(group, 10, 64)
149149
if gid == 0 {
150-
ctx.Redirect(strings.Replace(ctx.Req.URL.RequestURI(), "/0/", "/", 1))
150+
ctx.Redirect(strings.Replace(ctx.Req.URL.RequestURI(), "/0/", "/", 1), 307)
151151
return
152152
}
153153
group += "/"

routers/api/v1/repo/action.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1549,7 +1549,7 @@ func buildSignature(endp string, expires, artifactID int64) []byte {
15491549
}
15501550

15511551
func buildDownloadRawEndpoint(repo *repo_model.Repository, artifactID int64) string {
1552-
return fmt.Sprintf("api/v1/repos/%s/%s/actions/artifacts/%d/zip/raw", url.PathEscape(repo.OwnerName), url.PathEscape(repo.Name), artifactID)
1552+
return fmt.Sprintf("api/v1/repos/%s/%d/%s/actions/artifacts/%d/zip/raw", url.PathEscape(repo.OwnerName), repo.GroupID, url.PathEscape(repo.Name), artifactID)
15531553
}
15541554

15551555
func buildSigURL(ctx go_context.Context, endPoint string, artifactID int64) string {

services/context/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ func RepoAssignment(ctx *Context) {
432432
if q != "" {
433433
q = "?" + q
434434
}
435-
ctx.Redirect(strings.Replace(ctx.Link, "/0/", "/", 1) + q)
435+
ctx.Redirect(strings.Replace(ctx.Link, "/0/", "/", 1)+q, 307)
436436
return
437437
}
438438
group += "/"

tests/integration/actions_delete_run_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ jobs:
119119
runner.registerAsRepoRunner(t, user2.Name, apiRepo.Name, "mock-runner", []string{"ubuntu-latest"}, false)
120120

121121
opts := getWorkflowCreateFileOptions(user2, apiRepo.DefaultBranch, "create "+testCase.treePath, testCase.fileContent)
122-
createWorkflowFile(t, token, user2.Name, apiRepo.Name, testCase.treePath, opts)
122+
createWorkflowFile(t, token, user2.Name, apiRepo.Name, testCase.treePath, apiRepo.GroupID, opts)
123123

124124
runIndex := ""
125125
for i := 0; i < len(testCase.outcomes); i++ {

tests/integration/actions_job_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ jobs:
141141
t.Run("test "+tc.treePath, func(t *testing.T) {
142142
// create the workflow file
143143
opts := getWorkflowCreateFileOptions(user2, apiRepo.DefaultBranch, "create "+tc.treePath, tc.fileContent)
144-
fileResp := createWorkflowFile(t, token, user2.Name, apiRepo.Name, tc.treePath, opts)
144+
fileResp := createWorkflowFile(t, token, user2.Name, apiRepo.Name, tc.treePath, apiRepo.GroupID, opts)
145145

146146
// fetch and execute task
147147
for i := 0; i < len(tc.outcomes); i++ {
@@ -153,7 +153,7 @@ jobs:
153153
}
154154

155155
// check result
156-
req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/%s/actions/tasks", user2.Name, apiRepo.Name)).
156+
req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/%d/%s/actions/tasks", user2.Name, apiRepo.GroupID, apiRepo.Name)).
157157
AddTokenAuth(token)
158158
resp := MakeRequest(t, req, http.StatusOK)
159159
var actionTaskRespAfter api.ActionTaskResponse
@@ -323,7 +323,7 @@ jobs:
323323
for _, tc := range testCases {
324324
t.Run("test "+tc.treePath, func(t *testing.T) {
325325
opts := getWorkflowCreateFileOptions(user2, apiRepo.DefaultBranch, "create "+tc.treePath, tc.fileContent)
326-
createWorkflowFile(t, token, user2.Name, apiRepo.Name, tc.treePath, opts)
326+
createWorkflowFile(t, token, user2.Name, apiRepo.Name, tc.treePath, apiRepo.GroupID, opts)
327327

328328
for i := 0; i < len(tc.outcomes); i++ {
329329
task := runner.fetchTask(t)
@@ -373,7 +373,7 @@ jobs:
373373
- run: echo 'test the pull'
374374
`
375375
opts := getWorkflowCreateFileOptions(user2, baseRepo.DefaultBranch, "create "+wfTreePath, wfFileContent)
376-
createWorkflowFile(t, user2Token, baseRepo.OwnerName, baseRepo.Name, wfTreePath, opts)
376+
createWorkflowFile(t, user2Token, baseRepo.OwnerName, baseRepo.Name, wfTreePath, baseRepo.GroupID, opts)
377377
// user2 creates a pull request
378378
doAPICreateFile(user2APICtx, "user2-patch.txt", &api.CreateFileOptions{
379379
FileOptions: api.FileOptions{
@@ -465,7 +465,7 @@ jobs:
465465
- run: echo 'test the pull'
466466
`
467467
opts := getWorkflowCreateFileOptions(user2, baseRepo.DefaultBranch, "create "+wfTreePath, wfFileContent)
468-
createWorkflowFile(t, user2Token, baseRepo.OwnerName, baseRepo.Name, wfTreePath, opts)
468+
createWorkflowFile(t, user2Token, baseRepo.OwnerName, baseRepo.Name, wfTreePath, baseRepo.GroupID, opts)
469469
// user2 creates a pull request
470470
doAPICreateFile(user2APICtx, "user2-patch.txt", &api.CreateFileOptions{
471471
FileOptions: api.FileOptions{
@@ -617,8 +617,8 @@ func getWorkflowCreateFileOptions(u *user_model.User, branch, msg, content strin
617617
}
618618
}
619619

620-
func createWorkflowFile(t *testing.T, authToken, ownerName, repoName, treePath string, opts *api.CreateFileOptions) *api.FileResponse {
621-
req := NewRequestWithJSON(t, "POST", fmt.Sprintf("/api/v1/repos/%s/%s/contents/%s", ownerName, repoName, treePath), opts).
620+
func createWorkflowFile(t *testing.T, authToken, ownerName, repoName, treePath string, groupID int64, opts *api.CreateFileOptions) *api.FileResponse {
621+
req := NewRequestWithJSON(t, "POST", fmt.Sprintf("/api/v1/repos/%s/%d/%s/contents/%s", ownerName, groupID, repoName, treePath), opts).
622622
AddTokenAuth(authToken)
623623
resp := MakeRequest(t, req, http.StatusCreated)
624624
var fileResponse api.FileResponse

tests/integration/actions_log_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ jobs:
168168

169169
// create the workflow file
170170
opts := getWorkflowCreateFileOptions(user2, repo.DefaultBranch, "create "+tc.treePath, tc.fileContent)
171-
createWorkflowFile(t, token, user2.Name, repo.Name, tc.treePath, opts)
171+
createWorkflowFile(t, token, user2.Name, repo.Name, tc.treePath, repo.GroupID, opts)
172172

173173
// fetch and execute tasks
174174
for jobIndex, outcome := range tc.outcome {
@@ -206,7 +206,7 @@ jobs:
206206
jobID := jobs[jobIndex].ID
207207

208208
// download task logs from API and check content
209-
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/%s/actions/jobs/%d/logs", user2.Name, repo.Name, jobID)).
209+
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/%d/%s/actions/jobs/%d/logs", user2.Name, repo.GroupID, repo.Name, jobID)).
210210
AddTokenAuth(token)
211211
resp = MakeRequest(t, req, http.StatusOK)
212212
logTextLines = strings.Split(strings.TrimSpace(resp.Body.String()), "\n")

0 commit comments

Comments
 (0)