Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion routers/web/repo/view_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func prepareFileView(ctx *context.Context, entry *git.TreeEntry) {

blob := entry.Blob()

ctx.Data["Title"] = ctx.Tr("repo.file.title", ctx.Repo.Repository.Name+"/"+path.Base(ctx.Repo.TreePath), ctx.Repo.RefFullName.ShortName())
ctx.Data["Title"] = ctx.Tr("repo.file.title", ctx.Repo.Repository.Name+"/"+ctx.Repo.TreePath, ctx.Repo.RefFullName.ShortName())
ctx.Data["FileIsSymlink"] = entry.IsLink()
ctx.Data["FileTreePath"] = ctx.Repo.TreePath
ctx.Data["RawFileLink"] = ctx.Repo.RepoLink + "/raw/" + ctx.Repo.RefTypeNameSubURL() + "/" + util.PathEscapeSegments(ctx.Repo.TreePath)
Expand Down
3 changes: 1 addition & 2 deletions routers/web/repo/view_home.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"errors"
"fmt"
"net/http"
"path"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -146,7 +145,7 @@ func prepareToRenderDirectory(ctx *context.Context) {

if ctx.Repo.TreePath != "" {
ctx.Data["HideRepoInfo"] = true
ctx.Data["Title"] = ctx.Tr("repo.file.title", ctx.Repo.Repository.Name+"/"+path.Base(ctx.Repo.TreePath), ctx.Repo.RefFullName.ShortName())
ctx.Data["Title"] = ctx.Tr("repo.file.title", ctx.Repo.Repository.Name+"/"+ctx.Repo.TreePath, ctx.Repo.RefFullName.ShortName())
}

subfolder, readmeFile, err := findReadmeFileInEntries(ctx, ctx.Repo.TreePath, entries, true)
Expand Down
1 change: 1 addition & 0 deletions templates/repo/view_content.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{$isTreePathRoot := not .TreeNames}}

<div class="repo-view-content-data tw-hidden" data-document-title="{{ctx.RootData.Title}}"></div>
{{template "repo/sub_menu" .}}
<div class="repo-button-row">
<div class="repo-button-row-left">
Expand Down
9 changes: 6 additions & 3 deletions web_src/js/components/ViewFileTreeStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ export function createViewFileTreeStore(props: {repoLink: string, treePath: stri
},

async loadViewContent(url: string) {
url = url.includes('?') ? url.replace('?', '?only_content=true') : `${url}?only_content=true`;
const response = await GET(url);
document.querySelector('.repo-view-content').innerHTML = await response.text();
const u = new URL(url, window.origin);
u.searchParams.set('only_content', '1');
const response = await GET(u.href);
const elViewContent = document.querySelector('.repo-view-content');
elViewContent.innerHTML = await response.text();
document.title = elViewContent.querySelector('.repo-view-content-data').getAttribute('data-document-title');
},

async navigateTreeView(treePath: string) {
Expand Down