Skip to content
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

Color markings for .log files, not for .txt files #5253

Open
vincentkoevoets opened this issue Jan 13, 2024 · 3 comments
Open

Color markings for .log files, not for .txt files #5253

vincentkoevoets opened this issue Jan 13, 2024 · 3 comments
Labels
bug Something isn't working feature: formatting Features related to text formatting and node types good first issue Good for newcomers

Comments

@vincentkoevoets
Copy link

vincentkoevoets commented Jan 13, 2024

Describe the bug
Allright guys, I'm at a loss. I've spend the better part of today trying things, but I'm not getting this done. My problem is that Text opens my .log files correctly, but with colored text and also parts are italic. It recognizes the .log files as plain text correctly, because I have added the log file type as text/plain to mimetypemapping.json. So no rich editing, like it's supposed to do. But it appears to be formatting the text in some way anyway. The .log files are essentially just text files, but with a .log extension. If I change the extension in Nextcloud to .txt, the file loads correctly as plain black text without any formatting.
Edit: FYI: the log files in question have nothing to do with Nextcloud or Text, they are just log files for things I'm running on a server.

To Reproduce
Steps to reproduce the behavior:

  1. Open file with .log extension.
  2. See parts of text are colored, and some text in italic and maybe some other formatting.
  3. Close file, and change extension to .txt.
  4. Open file again, and behold! A plain text file without any formatting.

Expected behavior
Any file type that has been added as [text/plain] should be shown just like that: as plain text. (right?)

Screenshots
File with .log extension
Schermafbeelding 2024-01-13 171425
Same file but now with .txt extension
Schermafbeelding 2024-01-13 171509

Server details:

  • Nextcloud version: 28.0.1
  • PHP Version: 8.2.13
  • Database: Mysql 8.2.0

Client details:

  • OS: Windows, Linux
  • Browser: Chrome
  • Browser version: 120.0.6099.217
  • Device: Laptop, phone, desktop

Nextcloud log (data/nextcloud.log)

Nothing is showing in the logs

Browser log

I'll add this when needed.

@vincentkoevoets vincentkoevoets added the bug Something isn't working label Jan 13, 2024
@joshtrichards
Copy link
Member

Reproduced.

@joshtrichards joshtrichards added the feature: formatting Features related to text formatting and node types label Jan 19, 2024
@vincentkoevoets
Copy link
Author

vincentkoevoets commented Jan 13, 2025

Happy anniversary for this bug 🎉 Would there be any way to solve this? Except from changing all my .log files to .txt files? I mapped and aliased .log file as plain text, I don't really see what else I could do.

@juliusknorr
Copy link
Member

I'm not entirely sure what goes wrong but to debug this further one could check out what syntax highlight is loaded when opening such files, here would be some code pointers:

const language = extensionHighlight[this.fileExtension]
|| this.fileExtension
loadSyntaxHighlight(language)
.then(() => {
this.$editor = createPlainEditor({ language, extensions })

https://github.com/nextcloud/text/blob/c7f0c2932980e71d8c94fc4f155dbdf33852a08a/src/helpers/mappings.js

We have some manual mapping but if we don't find an entry in there we fallback to the file extension, which could then lead to odd highlight.

@juliusknorr juliusknorr added the good first issue Good for newcomers label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature: formatting Features related to text formatting and node types good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants