Skip to content

Feature: Add Subfolder Strategy for Automatic Uploads#56

Open
PhilippThaler wants to merge 8 commits intoopencloud-eu:mainfrom
PhilippThaler:feature/upload-subfolders-by-date
Open

Feature: Add Subfolder Strategy for Automatic Uploads#56
PhilippThaler wants to merge 8 commits intoopencloud-eu:mainfrom
PhilippThaler:feature/upload-subfolders-by-date

Conversation

@PhilippThaler
Copy link
Copy Markdown

Feature: Add Subfolder Strategy for Automatic Uploads

Based on #46

What does this PR do?

This PR introduces a new feature that allows users to automatically organize their camera uploads into subfolders based on the date the picture or video was taken. Users can choose to create subfolders by:

  • Year (/2025/)
  • Year and Month (/2025/11/)
  • Year, Month, and Day (/2025/11/09/)

This helps users keep their cloud storage tidy and makes it easier to browse through photos from specific dates.

How is this implemented?

  • Added UseSubfoldersBehaviour Enum:
    • A new enum was added to FolderBackUpConfiguration.kt to represent the different subfolder options (NONE, YEAR, YEAR_MONTH, YEAR_MONTH_DAY).
  • Updated AutomaticUploadsWorker:
    • Create the function buildUploadPath to construct the remote path dynamically based on the selected UseSubfoldersBehaviour and the file's last modified date.
  • Database and Migrations:
    • The FolderBackUpEntity and the corresponding database migration (MIGRATION_43_44) were updated to include the new useSubfoldersBehaviour field.

How to test this?

  1. Navigate to Settings > Automatic Uploads for either pictures or videos.
  2. Select a new option under the "Upload to Subfolders" preference.
  3. Add a new image/video to the source folder on your device.
  4. Wait for the automatic upload worker to run (or trigger it manually).
  5. Verify that the file is uploaded to the correct subfolder in your cloud account.
  6. Repeat for all subfolder options.

Screenshots

Screenshot_2025-11-09-23-34-29-553_eu opencloud android debug_1
Screenshot_2025-11-09-23-34-41-512_eu opencloud android debug_1

@PhilippThaler PhilippThaler force-pushed the feature/upload-subfolders-by-date branch 2 times, most recently from 426682e to 58a9e8a Compare November 9, 2025 22:51
@PhilippThaler PhilippThaler force-pushed the feature/upload-subfolders-by-date branch from 58a9e8a to fd65b96 Compare November 9, 2025 22:53
@PhilippThaler PhilippThaler marked this pull request as ready for review November 9, 2025 22:54
@RalphHeger
Copy link
Copy Markdown

Heavily waiting for that one :-)

@christinloehner
Copy link
Copy Markdown

this thing is soooo missing! Waiting for this as fu** :-)

@guruz
Copy link
Copy Markdown
Contributor

guruz commented Mar 27, 2026

Thank you for updating the PR.
See the build/detekt results ^

@PhilippThaler
Copy link
Copy Markdown
Author

Thanks for pointing that out. It was a simple typo that tripped up detekt. Fixed and verified.

@zerox80
Copy link
Copy Markdown
Contributor

zerox80 commented Apr 25, 2026

hi, ill start reviewing this

@zerox80
Copy link
Copy Markdown
Contributor

zerox80 commented Apr 25, 2026

Hey, looked through the changes and found a couple issues:

MIGRATION_43_44 conflicts with the existing AutoMigration

There's already an AutoMigration(from = 43, to = 44) on main - it adds the password_policy_* columns to the capabilities table. This PR adds a manual MIGRATION_43_44 for the same version pair. Room will use the manual migration and skip the auto one, which means the capabilities table changes get lost and the app crashes on upgrade for users on schema 43.

The migration should target 49->50 (current DB version is 49), not 43->44.

SQL syntax in Migration_44.kt

The DEFAULT clause produces DEFAULT NONE instead of DEFAULT 'NONE' — the string value needs quotes in SQL. But this whole file goes away if you fix the version anyway.

Legacy users get YEAR subfolders

Migration_34.kt sets useSubfoldersBehaviour = YEAR for existing users migrating from SharedPreferences. So existing camera upload users will start getting /CameraUpload/2026/ instead of /CameraUpload/. Might be intentional but worth confirming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants