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-android | |
| 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-android')
| -rw-r--r-- | packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/photos/PhotoPlan.kt | 4 | ||||
| -rw-r--r-- | packages/meshbay-android/app/src/test/kotlin/org/meshbay/client/PhotoSyncTest.kt | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/photos/PhotoPlan.kt b/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/photos/PhotoPlan.kt index de39669..7e7801d 100644 --- a/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/photos/PhotoPlan.kt +++ b/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/photos/PhotoPlan.kt @@ -128,9 +128,9 @@ object PhotoPlan { fun whenTaken(p: Photo): Long = if (p.taken > 0) p.taken else p.added * 1000 - /** `<folder>/YYYY/MM`, from when it was taken: an album is a directory (§9.9). */ + /** `<folder>/YYYY/YYYY-MM`, from when it was taken: an album is a directory (§9.9). */ fun dirFor(folder: String, p: Photo, zone: TimeZone): String { - val fmt = SimpleDateFormat("yyyy/MM", Locale.ROOT).apply { timeZone = zone } + val fmt = SimpleDateFormat("yyyy/yyyy-MM", Locale.ROOT).apply { timeZone = zone } return "$folder/${fmt.format(Date(whenTaken(p)))}" } diff --git a/packages/meshbay-android/app/src/test/kotlin/org/meshbay/client/PhotoSyncTest.kt b/packages/meshbay-android/app/src/test/kotlin/org/meshbay/client/PhotoSyncTest.kt index 24e1841..0e2e924 100644 --- a/packages/meshbay-android/app/src/test/kotlin/org/meshbay/client/PhotoSyncTest.kt +++ b/packages/meshbay-android/app/src/test/kotlin/org/meshbay/client/PhotoSyncTest.kt @@ -43,8 +43,8 @@ class PhotoSyncTest { @Test fun `everything already on the phone is sent, newest first, under its year and month`() { val out = plan(listOf(photo(1, taken = oct9 - 40L * 86400000), photo(2), photo(3, taken = oct9 - 86400000))) assertEquals(listOf(2L, 3L, 1L), out.map { it.photo.mediaId }) - assertEquals("Media/Photos/Bob/2026/10", out[0].dir) - assertEquals("Media/Photos/Bob/2026/08", out[2].dir) + assertEquals("Media/Photos/Bob/2026/2026-10", out[0].dir) + assertEquals("Media/Photos/Bob/2026/2026-08", out[2].dir) assertEquals("IMG_2.jpg", out[0].name) } @@ -79,7 +79,7 @@ class PhotoSyncTest { assertEquals(1, out.size) assertTrue(out[0].edited) assertEquals("IMG_1-edited-20261009-130000.jpg", out[0].name) - assertEquals("Media/Photos/Bob/2026/10", out[0].dir) + assertEquals("Media/Photos/Bob/2026/2026-10", out[0].dir) } @Test fun `a touch that left the bytes alone sends nothing`() { |