nextcloud / nextcloud/text

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

Open
#5,253 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug feature: code syntax highlighting feature: formatting good first issue
Dominant language
JavaScript
Stars
659
Forks
133
Avg merge
1d 20h
Merged PRs (30d)
110

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior with a .log file configured as text/plain in mimetypemapping.json, then compare it with the same content saved as .txt. Trace how the editor chooses formatting for these extensions. Done means text/plain files display as unformatted plain text regardless of whether the extension is .log or .txt.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.