XML-invalid characters break rich-workspace xml parsers in iOS client

Aperta
#9,511 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
markdown, php
Ambito
api, backend

Direzione di ricerca

Start by reproducing with the curl PROPFIND in the issue and piping the response to xmllint; the nc:rich-workspace property is where the raw Readme.md content lands unescaped. Find where the text app's rich-workspace property value is read and serialized into the DAV response, then check the linked fix branch in alpsayin/nextcloud-app-text for how it strips XML 1.0-invalid control characters. Done when the response body is well-formed XML and the directory listing shows again with the bad Readme.md present.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

0. Needs triage bug

Describe the bug
XML-1.0-invalid characters from a Readme.md file are directly put into the response of an rich-workspace request. Which then makes its way into iOS app and breaks its parser. It then stops listing the directory entirely https://github.com/nextcloud/ios/issues/4041 .
iOS side should probably not fall on its face entirely upon failing to parse the said XML but that can be tracked on https://github.com/nextcloud/ios/issues/4041 while this issue focuses on the serverside.

A server side fix proposal is at https://github.com/alpsayin/nextcloud-app-text/tree/fix/rich-workspace-invalid-xml-chars . It's AI authored, and I've seen and reviewed the code (there's a "BUT", carry on reading).
It has been tested on my own NC33 and some of the unit tests but I lack the infrastructure to run the suite asked by the contribution guidelines. As much as I'm a software engineer, I'm an embedded FW engineer who also lacks PHP and Nextcloud knowledge so I refrain from raising a PR myself.

To Reproduce
Steps to reproduce the behavior:

  1. Grab the attachment from https://github.com/nextcloud/ios/issues/4041#issuecomment-6574651262 put it into an account's as Templates/Readme.md . Don't leave the txt extension.
  2. Refresh the top level directory listing in iOS app.
  3. See the listing momentarily show and disappear until the Readme.md is removed.
  4. Or without the iOS app (the request is a reduced version of what the iOS app sends):
    curl -s -u <user>:<app-password> -X PROPFIND -H 'Depth: 1' -H 'Content-Type: application/xml' \
      --data '<?xml version="1.0"?><d:propfind xmlns:d="DAV:" xmlns:nc="http://nextcloud.org/ns"><d:prop><d:displayname/><nc:rich-workspace/></d:prop></d:propfind>' \
      https://<server>/remote.php/dav/files/<user>/ | xmllint --noout -
    
    With the corrupted Readme.md present, the server answers HTTP 207 but the body is not well-formed:
    -:14: parser error : PCDATA invalid Char value 22
    -:14: parser error : PCDATA invalid Char value 28
    -:14: parser error : PCDATA invalid Char value 16
    

Expected behavior

  1. Top level listing to show.

Screenshots
Somewhat applicable but it's just be a screenshot of no folders and files vs. a proper listing.

| Image Image

Server details:

  • Nextcloud version: 33.0.10 (Text app 7.0.1). Also reported on NC31/NC32 and on NC34.0.4 (AIO) in nextcloud/ios#4041
  • PHP Version: 8.3 (php-fpm, Apache 2.4.58)
  • Database: MariaDB 10.11.14

Client details:

  • OS: iOS 26.x
  • Browser: N/A, Nextcloud iOS app 35.2.2.0. Web, desktop and Android clients are not affected.
  • Browser version: N/A
  • Device: iPhone 12 mini. Also reported on other iPhones and iPad in nextcloud/ios#4041
Logs
Nextcloud log (data/nextcloud.log)
Nothing relevant is logged, even at loglevel 0 (debug). Over the hours when the iOS Files tab was empty, nextcloud.log has ~4,400 entries from the iOS app, all routine debug noise (IServerContainer deprecation, config lexicon notices, preview cache misses). There are no errors, nothing from the text app, and nothing about rich-workspace or XML. The server answers the PROPFIND with HTTP 207. The problem is only visible in the response body, which is malformed XML because the raw Readme.md content inside <nc:rich-workspace> contains bytes 0x10/0x16/0x1c
Browser log
Not applicable: iOS app (Nextcloud iOS 35.2.2.0). The iOS app's own debug log showed nothing either; the request "succeeds" and the listing is simply empty.
Lingua principale
JavaScript
Stelle
665
Fork
133
Merge medio
1g 9h
PR unite (30g)
180

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nextcloud/text

Tutte le issue di nextcloud/text

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.