diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-10-10 10:28:12 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-10-10 10:28:12 +0200 |
| commit | 734b922370a56c7e3577c1f6bbdad69f75301334 (patch) | |
| tree | 3d016fe675672f07ebc6920912738004d4572038 /packages/meshbay-hub | |
| parent | c100de578a49915dfc7ca5c30534ccccfd23d46c (diff) | |
| download | meshbay-734b922370a56c7e3577c1f6bbdad69f75301334.tar.gz | |
fix(android): back photos up under YYYY/YYYY-MM, not YYYY/MM
A month folder named 08 alone read like an album number.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/static/photo-sync.js | 2 | ||||
| -rw-r--r-- | packages/meshbay-hub/tests/test_photo_sync.py | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/photo-sync.js b/packages/meshbay-hub/src/meshbay_hub/static/photo-sync.js index 154a009..74084b8 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/photo-sync.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/photo-sync.js @@ -249,7 +249,7 @@ async function upload(transport, item) { } } -/** `<folder>/YYYY/MM`, one level at a time; a level that exists is fine. */ +/** `<folder>/YYYY/YYYY-MM`, one level at a time; a level that exists is fine. */ async function makeDirs(transport, folder, dir, dirs) { let at = folder; for (const name of dir.slice(folder.length + 1).split('/').filter(Boolean)) { diff --git a/packages/meshbay-hub/tests/test_photo_sync.py b/packages/meshbay-hub/tests/test_photo_sync.py index f7852f4..cbc5f5d 100644 --- a/packages/meshbay-hub/tests/test_photo_sync.py +++ b/packages/meshbay-hub/tests/test_photo_sync.py @@ -63,7 +63,7 @@ fake.status = { lastCompleted: null, failure: null, failureAt: null, }; fake.items = [ - { token: 't1', name: 'IMG_3.jpg', dir: 'Media/Photos/Bob/2026/10', size: 30, edited: false, + { token: 't1', name: 'IMG_3.jpg', dir: 'Media/Photos/Bob/2026/2026-10', size: 30, edited: false, alsoKnownAs: 'IMG_3-edited-x.jpg' }, { token: 't2', name: 'IMG_2.jpg', dir: 'Media/Photos/Bob/2026/09', size: 20, edited: false, alsoKnownAs: 'IMG_2-edited-x.jpg' }, @@ -143,11 +143,11 @@ def test_a_due_run_sends_newest_first_and_records_each(tmp_path): # IMG_1 is already in the folder (a reinstall's empty ledger): recorded, # not sent again. assert _of(log, "upload") == [ - ["Media/Photos/Bob/2026/10", "IMG_3.jpg", "tr-30"], + ["Media/Photos/Bob/2026/2026-10", "IMG_3.jpg", "tr-30"], ["Media/Photos/Bob/2026/09", "IMG_2.jpg", "tr-20"], ] assert _of(log, "sent") == [ - ["t1", "Media/Photos/Bob/2026/10", "IMG_3.jpg"], + ["t1", "Media/Photos/Bob/2026/2026-10", "IMG_3.jpg"], ["t2", "Media/Photos/Bob/2026/09", "IMG_2.jpg"], ["t3", "Media/Photos/Bob/2026/09", "IMG_1.jpg"], ] @@ -158,7 +158,7 @@ def test_a_due_run_sends_newest_first_and_records_each(tmp_path): def test_only_missing_folders_are_made_and_parents_first(tmp_path): log = _run(_start(), tmp_path) - assert _of(log, "mkdir") == [["Media/Photos/Bob/2026/10"]] + assert _of(log, "mkdir") == [["Media/Photos/Bob/2026/2026-10"]] def test_every_upload_holds_a_slot_and_gives_it_back(tmp_path): @@ -170,9 +170,9 @@ def test_every_upload_holds_a_slot_and_gives_it_back(tmp_path): def test_an_edit_under_its_own_name_counts_as_already_there(tmp_path): log = _run(_start(""" -fake.index.entries.push({ path: 'Media/Photos/Bob/2026/10', name: 'IMG_3-edited-x.jpg', size: 30 }); +fake.index.entries.push({ path: 'Media/Photos/Bob/2026/2026-10', name: 'IMG_3-edited-x.jpg', size: 30 }); """), tmp_path) - assert ["t1", "Media/Photos/Bob/2026/10", "IMG_3-edited-x.jpg"] in _of(log, "sent") + assert ["t1", "Media/Photos/Bob/2026/2026-10", "IMG_3-edited-x.jpg"] in _of(log, "sent") assert all(u[1] != "IMG_3.jpg" for u in _of(log, "upload")) |