fix:3293: parse last-modified and etag case-insensitive
Description
Notes app occasionally shows "Synchronization failed" at opening. It seems random, but there could be a correlation with having a local account set up with the cloud accounts.
For me, it's happening as soon as I create multiple new notes and notes app tries to sync with murena.io Please remember, I already have 1500+ notes in my list of notes.
When a new notes is added, Notes-Android app make a call to get all the modifications since last call, to ensure proper synchronisation. It appears that the call doesn't get the expected lastModified timestamp, but always 0 instead:
https://murena.io/index.php/apps/notes/api/v1/notes?pruneBefore=0
With this parameter, this call returns the whole notes of the user, which consume bandwidth and can take more than 60s, which cause timeout, and taost the error.
Root cause is that the app look for ETag and Last-Modified headers, while the server send these headers with lowercase keys.
Second issue, is that start of the app, the import take care to import the the notes one by one, but it doesn't set any lastModified in the account. As a consequence, on next Note addition, the whole notes will be downloaded again (or may fail).
Tests
- Add a lot of notes in you Murena.io account
- Clean Notes app data
- Open notes, and wait for full synchronisation
- Then add a new notes
- Sync should run smoothly,
- and analysing the traffic, you shoudln't observe any call to
https://murena.io/index.php/apps/notes/api/v1/notes?pruneBefore=0with pruneBefore == 0
Issues
https://gitlab.e.foundation/e/os/backlog/-/issues/3293