Skip to content

Text overrides restored file due to trailing newline #9077

Description

@AndyScherzinger

Describe the bug
Text auto saves unchanged file upon opening, no editing, due to a normalizer behavior. See videos:

To Reproduce
From the video, you need to restore a file and needs to have one specific thing, a trailing newline::

  1. restored version : 150 bytes, tail "...old line :)\n\n🌴\n"
  2. what Text wrote : 149 bytes, tail "...old line :)\n\n🌴"
  3. first difference at byte 149: restored "\n" vs written ""

Expected behavior
The serialiser should preserve a trailing newline, or SaveService should not write when the only difference is its own normalization. It's easy to demonstrate without Notes at all - put a markdown file ending in a newline in Files, open it in the Viewer, don't touch it, and a version appears within ~10 seconds.

Screenshots

text_in_files_viewer.mp4
text_editor.mp4

Server details:

  • Nextcloud version: master
  • PHP Version: -
  • Database: -
  • I use the docker dev setup

Client details:

  • OS: Win11pro
  • Browser: FF
  • Browser version: 153.0.4
  • Device: Desktop
Logs

Nextcloud log (data/nextcloud.log)

Insert your Nextcloud log here

Browser log

Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log
c) ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions