Fixed 404 caused by unexpected question mark#17
Fixed 404 caused by unexpected question mark#17metalmatze merged 1 commit intomasterfrom unknown repository
Conversation
|
Please reopen against master. |
|
Could you provide a testcase for the issue, or at least instructions to reproduce ? |
|
@strk It's a simple case of creating a file with '?' in the filename. |
modules/template/template.go
Outdated
There was a problem hiding this comment.
I don't understand here what the dark red color on percent sign means, do you ?
There was a problem hiding this comment.
It's not important, it's just invalid highlighting.
There was a problem hiding this comment.
A better method is to define as a static replacer
var replacerEscapePound = strings.NewReplacer("%", "%25", "#", "%23", " ", "%20", "?", "%3F")And then replace the two palces of references.
|
Quick question, doesn't golang have a URL_escape? :) |
|
Yet you can't use QueryEscape for filenames though. |
|
Could the code duplication be avoided by putting the replace code in a common function ? |
|
Besides, I just tested reproducing and I go the 404 before and after applying your patch |
|
@strk can you tell me what you did to get the 404? |
|
I reloaded the URL I got the 404 from before the patch (url containing the |
|
Meanwhile please consider removing the code duplication, and maybe put the shared function under automatic testing |
|
Ok, reloading the previous page gives the correct link. So LGTM (but code duplication would really be better to avoid) |
|
LGTM |
This fixes 404 caused when creating new files or wiki pages with question marks. Amended to force CI rebuild
Current coverage is 3.14% (diff: 100%)@@ master #17 diff @@
========================================
Files 33 33
Lines 7823 7823
Methods 0 0
Messages 0 0
Branches 0 0
========================================
Hits 246 246
Misses 7557 7557
Partials 20 20
|
|
LGTM |
* Avoid creating an array for the sole purpose of counting elements Probably speeds up counting commits for git versions < 1.8.0, although I dubt it would make a visible difference * Fix commit count with git version < 1.8.0 With format='' the output does not end with a newline (checked)
Added real name of Bwko to maintainers file
- Implemented 300ms debounce for search API calls to prevent excessive requests - Added in-memory cache with 5-minute TTL for search results - Cache keys are scoped by uid and query to prevent conflicts - Added automatic cache cleanup when size exceeds 50 entries - Improved error handling for failed API calls - Used throttle-debounce library (already in project dependencies) Performance improvements: - Reduces server load by limiting API calls during rapid typing - Improves UX with instant results for repeated/cached queries - Maintains responsive search experience with 300ms debounce delay Fixes okTurtles/forkana#17
Very simply, this pull request modifies certain files to escape symbols in filenames that may cause 404s unescaped.