-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Wiki pages are stored as/converted to CRLF line endings #17541
Comments
In my opinion: It is a browser behavior, I think Gitea (Web UI) should not touch it: Nowadays, all modern applications in all OS can handle CRLF and LF correctly, so it won't be a problem. The If you edit files locally, git respects settings like If these methods are not enough, then maybe we need to think about a plan to cover all cases, maybe Gitea can set settings in |
What
I think the
|
Related to this behavior: Browsers always use "CRLF" for new lines when a textarea is submitted. So, Gitea need to do extra converting before it really writes the content into the repo. |
@wxiaoguang Yet, compared to those things, support of the |
Exactly, Gitea should not touch it and silently convert my files. Honestly I don't care which settings the textarea in the browser uses. If it always uses CRLF, then the web editor should behave like any other Windows user and make use of the When editing files via the webeditor in a normal (non-wiki-) repo, (almost) everything behaves as it should and LF files are not converted. So I really don't understand the problem: why can it apparently be done for the README.md in my repo, but not the Home.md in the wiki? (I also tried how Github handles this issues, here Wiki files with LF endings are not converted.) |
Let me share more information: according to HTML standard, the "newline/EOL" is always "CRLF" in HTML's textarea. So Gitea backend could always get "CRLF" from a textarea.
Because "LF" is hard-coded in non-wiki backend code, all CRLF are replaced by LF in backend for these files (well, Windows users might feel unhappy about this behavior ....) I also agree that it should do the best to make EOL correct. So the solutions could be:
Or, as a quick fix: always use "LF" for wiki files, too, just like these non-wiki files. |
ps: original wiki code wasn't written by me, neither the editor/upload code, I just happen to know the details 🤣 if I would have enough time I could also look into the problem and/or try to improve it, but I can't promise at the moment. |
Thank you for the info.
I hadn't even noticed that yet, but yeah, that's suboptimal as well. I cannot argue which solution would be better – both have to do an "auto detect", so it probably doesn't matter if you do it in the front- or backend. 2. is more closely what
Yes, I agree it should at least be consistent (else I have to always configure my wiki-repos different than the normal ones, very confusing). |
Gitea Version
1.16.0+dev-455-ga5bcf1994
Git Version
No response
Operating System
No response
How are you running Gitea?
Tried in https://try.gitea.io/plgruener/wikitest/wiki/_pages
Database
No response
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Description
Any wiki page that is created in the webeditor (wiki/_new) is stored as file with (Windows-style) CRLF line endings, not LF (Unix-style).
This also means every wiki-page that is created locally with LF line endings (eg under Linux or MacOS) and then pushed is silently converted to CRLF, either on push itself or when that page is edited in the webeditor by another person. Since that LF->CRLF conversion changes every line, it makes a diff essentially useless.
Screenshots
No response
The text was updated successfully, but these errors were encountered: