Skip to content

1.21 broke Linux EOL in code editor #28097

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

Closed
testdasi opened this issue Nov 17, 2023 · 4 comments · Fixed by #28101
Closed

1.21 broke Linux EOL in code editor #28097

testdasi opened this issue Nov 17, 2023 · 4 comments · Fixed by #28101
Labels

Comments

@testdasi
Copy link

Description

Updated to 1.21 and now any change via web editor always use Windows EOL, quite possibly because the browser itself runs in a Windows PC.

The stupid part is the editor itself successfully detected these are bash scripts, which must be Linux!
I can't find any documentation on how to permanently use Linux EOL so now I'm stuck.

Tried revert back to 1.20 and of course gitea blocked it too.

Gitea Version

1.21

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Gitea docker on Ubuntu.
Browser access on Windows PC.

Database

None

@silverwind
Copy link
Member

silverwind commented Nov 17, 2023

any change via web editor always use Windows EOL, quite possibly because the browser itself runs in a Windows PC.

That should not be the behaviour I tested. Do you have a .editorconfig file in the repo? If not, it should use LF already, the browser OS is not part of the detection in the Monaco editor, as far as I'm aware. It should give you LF when no .editorconfig is present.

As per my current understanding, the only way you get CRLF is when you have a .editorconfig specifying CRLF for the file or when the file is already predominantly in CRLF. All other cases should get you LF.

@silverwind
Copy link
Member

@testdasi please let me know what this displays on your affected machine:

image

@testdasi
Copy link
Author

testdasi commented Nov 17, 2023

It's "\r\n" for both Chrome, Firefox, Edge. Even when I spoofed my User Agent as a Mac Firefox. :(
image

@silverwind
Copy link
Member

Interesting, so Monaco seems to use OS defaults for files without a dominant ending. I think we should default it to \n but have a config option in case someone wants to change this default.

lunny pushed a commit that referenced this issue Nov 22, 2023
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Nov 22, 2023
silverwind pushed a commit that referenced this issue Nov 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 7, 2024
fuxiaohei pushed a commit to fuxiaohei/gitea that referenced this issue Jan 17, 2024
silverwind pushed a commit to silverwind/gitea that referenced this issue Feb 20, 2024
project-mirrors-bot-tu bot pushed a commit to project-mirrors/forgejo-as-gitea-fork that referenced this issue Jan 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
2 participants