forked from tangled.org/core
this repo has no description

appview: state/repo: do not switch to dids in links

fixes a a few links in blob and tree views that caused the link to
switch from handle to did.

authored by oppi.li and committed by Tangled cf269c55 5ef51421

Changed files
+13 -5
appview
state
+13 -5
appview/state/repo.go
··· 319 user := s.auth.GetUser(r) 320 321 var breadcrumbs [][]string 322 - breadcrumbs = append(breadcrumbs, []string{f.RepoName, fmt.Sprintf("/%s/%s/tree/%s", f.OwnerDid(), f.RepoName, ref)}) 323 if treePath != "" { 324 for idx, elem := range strings.Split(treePath, "/") { 325 breadcrumbs = append(breadcrumbs, []string{elem, fmt.Sprintf("%s/%s", breadcrumbs[idx][1], elem)}) 326 } 327 } 328 329 - baseTreeLink := path.Join(f.OwnerDid(), f.RepoName, "tree", ref, treePath) 330 - baseBlobLink := path.Join(f.OwnerDid(), f.RepoName, "blob", ref, treePath) 331 332 s.pages.RepoTree(w, pages.RepoTreeParams{ 333 LoggedInUser: user, ··· 454 } 455 456 var breadcrumbs [][]string 457 - breadcrumbs = append(breadcrumbs, []string{f.RepoName, fmt.Sprintf("/%s/%s/tree/%s", f.OwnerDid(), f.RepoName, ref)}) 458 if filePath != "" { 459 for idx, elem := range strings.Split(filePath, "/") { 460 breadcrumbs = append(breadcrumbs, []string{elem, fmt.Sprintf("%s/%s", breadcrumbs[idx][1], elem)}) ··· 861 } 862 863 func (f *FullyResolvedRepo) OwnerSlashRepo() string { 864 - p, _ := securejoin.SecureJoin(f.OwnerDid(), f.RepoName) 865 return p 866 } 867
··· 319 user := s.auth.GetUser(r) 320 321 var breadcrumbs [][]string 322 + breadcrumbs = append(breadcrumbs, []string{f.RepoName, fmt.Sprintf("/%s/tree/%s", f.OwnerSlashRepo(), ref)}) 323 if treePath != "" { 324 for idx, elem := range strings.Split(treePath, "/") { 325 breadcrumbs = append(breadcrumbs, []string{elem, fmt.Sprintf("%s/%s", breadcrumbs[idx][1], elem)}) 326 } 327 } 328 329 + baseTreeLink := path.Join(f.OwnerSlashRepo(), "tree", ref, treePath) 330 + baseBlobLink := path.Join(f.OwnerSlashRepo(), "blob", ref, treePath) 331 332 s.pages.RepoTree(w, pages.RepoTreeParams{ 333 LoggedInUser: user, ··· 454 } 455 456 var breadcrumbs [][]string 457 + breadcrumbs = append(breadcrumbs, []string{f.RepoName, fmt.Sprintf("/%s/tree/%s", f.OwnerSlashRepo(), ref)}) 458 if filePath != "" { 459 for idx, elem := range strings.Split(filePath, "/") { 460 breadcrumbs = append(breadcrumbs, []string{elem, fmt.Sprintf("%s/%s", breadcrumbs[idx][1], elem)}) ··· 861 } 862 863 func (f *FullyResolvedRepo) OwnerSlashRepo() string { 864 + handle := f.OwnerId.Handle 865 + 866 + var p string 867 + if handle != "" && !handle.IsInvalidHandle() { 868 + p, _ = securejoin.SecureJoin(fmt.Sprintf("@%s", handle), f.RepoName) 869 + } else { 870 + p, _ = securejoin.SecureJoin(f.OwnerDid(), f.RepoName) 871 + } 872 + 873 return p 874 } 875