-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
WIP: Add subdir support for wiki pages #27900
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
Conversation
I didnt Modify: |
Okay, I now understand what the wiki_path.go is for, its for escaping, now I know what to do next |
Okay, I tested everything that I can locally run so far, I hope that I pass Migration this Time |
You can run the tests with |
Dont I need to setup an extra test DB for that? |
No, that's the magic word |
Ahh okay, thanks, executing SQlite Test locally works, gonna use that one to debunk what ive did |
Out of curiosity, did you create the graph by hand? |
I used draw.io, but yes, I put it together myself |
Are there any chances this PR will be merged any time soon? |
Nope, Prolly not |
Hi snoweuph. Thank you for your work! The "wiki" feature in Gitea has some longstanding problems, when we would like to improve/fix them, maybe the compatibility/migration for legacy wikis should also be considered together. For this PR, I think it has finishes the new features. Meanwhile I think it needs to clarify "how to deal with existing legacy wikis". And I can see there are still some related CI failures, I guess this PR wouldn't be merged into 1.22. To resolve the wiki path problems together, I think it needs a "V2" path standard in the future:
|
I'm aware that there is still some stuff, I would need to Fix, but i'm pretty busy currently in Reallife, so I wont be able to work on this for prolly atleast 2 more months. |
im back (atleast a littlebit) |
I just did a reset, to be up to date with the latest main, and im redoing the whole thing, with better doc this time. I will need some time though |
I just started creating a mermaid flowchart to represent the escaping and unespaing to then plan a better thing. flowchart TD
subgraph builtin
url.QueryEscape[["url.QueryEscape"]]
url.QueryUnescape[["url.QueryUnescape()"]]
end
subgraph wiki_path.go
WebPathFromRequest[["WebPathFromRequest <a>/</a> => <a>%2F</a>"]]
subgraph hasDashMarker
hasDashMarker_input(("input")) --> hasDashMarker_check{{"ends with <a>.-</a> ?"}}
hasDashMarker_check -->|"YES"| hasDashMarker_return_1>"return <a>TRUE</a>"]
hasDashMarker_check -->|"NO"| hasDashMarker_return_2>"return <a>FALSE</a>"]
end
subgraph trimDashMarker
trimDashMarker_input(("input")) --> trimDashMarker_return_1>"trim <a>.-</a>"]
end
subgraph addDashMarker
addDashMarker_input(("input")) --> addDashMarker_return_1>"add suffix <a>.-</a>"]
end
subgraph unescapeSegment
unescapeSegment_input(("input")) --> unescapeSegment_call_1(["call"]) -.-> hasDashMarker
unescapeSegment_call_1 --> unescapeSegment_check_1{{"Was <a>TRUE</a> ?"}}
unescapeSegment_check_1 -->|"YES"| unescapeSegment_call_2(["call"]) -.-> trimDashMarker
unescapeSegment_check_1 -->|"NO"| unescapeSegment_action_1["replace all '-' with ' '"]
unescapeSegment_call_2 & unescapeSegment_action_1 --> unescapeSegment_call_3(["call"]) -.-> url.QueryUnescape
unescapeSegment_call_3 --> unescapeSegment_check_2{{"<a>error<a> ?"}}
unescapeSegment_check_2 -->|"YES"| unescapeSegment_return_1>"return <a>error<a>"]
unescapeSegment_check_2 -->|"NO"| unescapeSegment_return_1["return"]
end
subgraph escapeSegToWeb
escapeSegToWeb_input(("input(<a>had_dashmarker</a>)")) --> escapeSegToWeb_check_1{{"had_dashmarker?"}}
escapeSegToWeb_check_1 -->|"YES"| escapeSegToWeb_call_1(["call"]) -.-> addDashMarker
escapeSegToWeb_check_1 -->|"NO"| escapeSegToWeb_check_2{{"contains '-' ?"}}
escapeSegToWeb_check_2 -->|"YES"| escapeSegToWeb_call_2(["call"]) -.-> addDashMarker
escapeSegToWeb_check_2 -->|"NO"| escapeSegToWeb_check_3{{"ends with <a>.md</a> ?"}}
escapeSegToWeb_check_3 -->|"YES"| escapeSegToWeb_call_3(["call"]) -.-> addDashMarker
escapeSegToWeb_check_3 -->|"NO"| escapeSegToWeb_action_1{{"replace all ' ' with '-'"}}
escapeSegToWeb_call_1 & escapeSegToWeb_call_2 & escapeSegToWeb_call_3 & escapeSegToWeb_action_1 --> escapeSegToWeb_call_4(["call"]) -.-> url.QueryEscape
escapeSegToWeb_call_4 --> escapeSegToWeb_return>"return"]
end
subgraph GitPathToWebPath
GitPathToWebPath_input(("input"))
GitPathToWebPath_check_1{{"ends with <a>.md</a> ?"}}
GitPathToWebPath_input --> GitPathToWebPath_check_1
GitPathToWebPath_action_1["trim <a>.md</a>"]
GitPathToWebPath_return_1>"return <a>ErrWikiInvalidFileName</a>"]
GitPathToWebPath_check_1 -->|"YES"|GitPathToWebPath_action_1
GitPathToWebPath_check_1 -->|"NO"|GitPathToWebPath_return_1
GitPathToWebPath_action_1 --> GitPathToWebPath_action_2["split at <a>/</a>"]
GitPathToWebPath_action_2 --> GitPathToWebPath_loopstart_1[/"loop over each <a>entry</a>"\]
GitPathToWebPath_loopstart_1 --> GitPathToWebPath_call_1(["call, write to <a>shouldAddDashMarker</a>"]) -.-> hasDashMarker
GitPathToWebPath_call_1 --> GitPathToWebPath_call_2([call]) -.-> unescapeSegment
GitPathToWebPath_call_2 --> GitPathToWebPath_check_2{{"<a>error</a> ?"}}
GitPathToWebPath_check_2 -->|"YES"| GitPathToWebPath_return_2>"return <a>error</a>"]
GitPathToWebPath_check_2 --> |"NO"| GitPathToWebPath_call_3(["call with <a>shouldAddDashMarker</a>"]) -.-> escapeSegToWeb
GitPathToWebPath_call_3 --> GitPathToWebPath_loopend_1[\"loop end"/]
GitPathToWebPath_loopend_1 --> GitPathToWebPath_action_3["join with <a>/</a>"]
GitPathToWebPath_action_3 --> GitPathToWebPath_return_3>"return"]
end
end
subgraph wiki.go
view(("Wiki View")) --> renderViewPage
subgraph renderViewPage
renderViewPage_input(("input"))
renderViewPage_call_1(["call per entry"]) -.-> GitPathToWebPath
renderViewPage_call_2(["call"]) -.-> WebPathFromRequest
renderViewPage_input --> renderViewPage_call_1 --> renderViewPage_call_2
end
end
After I understand the whole Process, I will defenitly have to think about a solution to make the whole thing easier to understand and maintain lmao |
Fixes #27858
Description
This PR is about Adding Support for Subdirs in Gitea Wikis like stated in #27858
I Tested that with this PR: