-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix images in Wiki repo not showing in Gitea Wiki (#4690) #5013
Conversation
wikiRaw method in routers calls WikiNameToFilename which unconditionally adds ".md" to the path. As a result, findEntryForFile will fail finding the corresponding git blob. I added WikiNameToFilenameRaw to the model used in wikiRaw which omits any additions to the filename.
Please fmt and commit. |
Codecov Report
@@ Coverage Diff @@
## master #5013 +/- ##
==========================================
+ Coverage 37.5% 37.56% +0.06%
==========================================
Files 309 309
Lines 45820 45820
==========================================
+ Hits 17183 17214 +31
+ Misses 26176 26142 -34
- Partials 2461 2464 +3
Continue to review full report at Codecov.
|
Tests will be better. |
models/wiki.go
Outdated
name = strings.Replace(name, " ", "-", -1) | ||
return url.QueryEscape(name) | ||
} | ||
|
||
// WikiFilenameToName converts a wiki filename to its corresponding page name. | ||
func WikiFilenameToName(filename string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WikiNameToFilename
should reuse WikiNameToFilenameRaw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review.
Now that I look at the code of models/wiki.go again I can't see the difference between WikiNameToFilenameRaw
and WikiNameToSubURL
. I think I totally duplicated a method that was already in place... Doh.
I will fix that.
Gentle bump. 😃 |
@mattzzw as I mentioned before could you add some tests that will let review easier. |
I think this has been fixed by #5814 |
wikiRaw method in routers calls WikiNameToFilename which unconditionally adds ".md" to the path.
As a result, findEntryForFile will fail finding the corresponding git blob.
I added WikiNameToFilenameRaw to the model used in wikiRaw which omits any additions to the filename.
Signed-off-by: Matthias Wientapper m.wientapper@gmx.de