diff options
author | Rafael <git@rafael.ovh> | 2024-04-10 18:49:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-10 17:49:57 +0000 |
commit | c1f76aea45f11e1d5ae22c047cf3bda9c681de8d (patch) | |
tree | ebf837b7b527c2eb79a27dbb08803a1c696f930b /tests | |
parent | 50099d7af436785daf66a3a9f27bd5c009f90684 (diff) | |
download | gitea-c1f76aea45f11e1d5ae22c047cf3bda9c681de8d.tar.gz gitea-c1f76aea45f11e1d5ae22c047cf3bda9c681de8d.zip |
Use raw Wiki links for non-renderable Wiki files (#30273)
In Wiki pages, short-links created to local Wiki files were always
expanded as regular Wiki Links. In particular, if a link wanted to point
to a file that Gitea doesn't know how to render (e.g, a .zip file), a
user following the link would be silently redirected to the Wiki's home
page.
This change makes short-links* in Wiki pages be expanded to raw wiki
links, so these local wiki files may be accessed without manually
accessing their URL.
* only short-links ending in a file extension that isn't renderable are
affected.
Closes #27121.
Signed-off-by: Rafael Girão <rafael.s.girao@tecnico.ulisboa.pt>
Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'tests')
7 files changed, 3 insertions, 1 deletions
diff --git a/tests/gitea-repositories-meta/user2/repo1.wiki.git/objects/81/a1c039774e337621609336c0e44ed9f92278f7 b/tests/gitea-repositories-meta/user2/repo1.wiki.git/objects/81/a1c039774e337621609336c0e44ed9f92278f7 Binary files differnew file mode 100644 index 0000000000..17a5547da8 --- /dev/null +++ b/tests/gitea-repositories-meta/user2/repo1.wiki.git/objects/81/a1c039774e337621609336c0e44ed9f92278f7 diff --git a/tests/gitea-repositories-meta/user2/repo1.wiki.git/objects/91/dc55f9de16a558e859123f2b99668469b1a1dc b/tests/gitea-repositories-meta/user2/repo1.wiki.git/objects/91/dc55f9de16a558e859123f2b99668469b1a1dc Binary files differnew file mode 100644 index 0000000000..8390a40c08 --- /dev/null +++ b/tests/gitea-repositories-meta/user2/repo1.wiki.git/objects/91/dc55f9de16a558e859123f2b99668469b1a1dc diff --git a/tests/gitea-repositories-meta/user2/repo1.wiki.git/objects/a5/bbc0fd39a696feabed2d4cccaf05abbcaf3b02 b/tests/gitea-repositories-meta/user2/repo1.wiki.git/objects/a5/bbc0fd39a696feabed2d4cccaf05abbcaf3b02 new file mode 100644 index 0000000000..94312d3db6 --- /dev/null +++ b/tests/gitea-repositories-meta/user2/repo1.wiki.git/objects/a5/bbc0fd39a696feabed2d4cccaf05abbcaf3b02 @@ -0,0 +1 @@ +xKn D죱vEQ~n@3Fr\,d^TSϏGj|K+D
$2`4YYu{Xho\u4E;k- P4Q^H84lk.i_|gVv=|-Uq8;ZJ,Nn_0a3ҿ Tmķq1m؍b^z/_5zR'-'~tl
\ No newline at end of file diff --git a/tests/gitea-repositories-meta/user2/repo1.wiki.git/objects/cf/19952a40b92eb2f86689146a65ac2d87c0818a b/tests/gitea-repositories-meta/user2/repo1.wiki.git/objects/cf/19952a40b92eb2f86689146a65ac2d87c0818a Binary files differnew file mode 100644 index 0000000000..b384e5c72e --- /dev/null +++ b/tests/gitea-repositories-meta/user2/repo1.wiki.git/objects/cf/19952a40b92eb2f86689146a65ac2d87c0818a diff --git a/tests/gitea-repositories-meta/user2/repo1.wiki.git/objects/e1/6da91326b845f1ba86a7df0a67db352f96dcb0 b/tests/gitea-repositories-meta/user2/repo1.wiki.git/objects/e1/6da91326b845f1ba86a7df0a67db352f96dcb0 Binary files differnew file mode 100644 index 0000000000..da281ff791 --- /dev/null +++ b/tests/gitea-repositories-meta/user2/repo1.wiki.git/objects/e1/6da91326b845f1ba86a7df0a67db352f96dcb0 diff --git a/tests/gitea-repositories-meta/user2/repo1.wiki.git/refs/heads/master b/tests/gitea-repositories-meta/user2/repo1.wiki.git/refs/heads/master index 38984b12b7..b352f15003 100644 --- a/tests/gitea-repositories-meta/user2/repo1.wiki.git/refs/heads/master +++ b/tests/gitea-repositories-meta/user2/repo1.wiki.git/refs/heads/master @@ -1 +1 @@ -0dca5bd9b5d7ef937710e056f575e86c0184ba85 +a5bbc0fd39a696feabed2d4cccaf05abbcaf3b02 diff --git a/tests/integration/git_clone_wiki_test.go b/tests/integration/git_clone_wiki_test.go index d7949dfe25..ef662300f3 100644 --- a/tests/integration/git_clone_wiki_test.go +++ b/tests/integration/git_clone_wiki_test.go @@ -45,6 +45,7 @@ func TestRepoCloneWiki(t *testing.T) { assertFileExist(t, filepath.Join(dstPath, "Page-With-Image.md")) assertFileExist(t, filepath.Join(dstPath, "Page-With-Spaced-Name.md")) assertFileExist(t, filepath.Join(dstPath, "images")) + assertFileExist(t, filepath.Join(dstPath, "files/Non-Renderable-File.zip")) assertFileExist(t, filepath.Join(dstPath, "jpeg.jpg")) }) }) |