Skip to content

feat(files): support file datastore uploads - #673

Open
mreq wants to merge 12 commits into
masterfrom
feat/local-files
Open

mreq wants to merge 12 commits into
masterfrom
feat/local-files

Conversation

@mreq

@mreq mreq commented Aug 17, 2026

Copy link
Copy Markdown
Member

No description provided.

@mreq
mreq requested a lite review from Copilot August 17, 2026 09:20
@mreq mreq self-assigned this Aug 17, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds first-class support for using Dragonfly’s :file datastore (local filesystem) while preserving the existing “direct upload” flow that previously assumed S3, including datastore-aware thumbnail URL generation.

Changes:

  • Introduces configurable Dragonfly datastore selection (:s3 vs :file) plus related configuration/documentation and a dev env flag.
  • Adds local direct-upload/direct-download API endpoints (tokenized) to mimic S3-style presigned URL flows when using file storage.
  • Updates thumbnail URL generation (and related jobs/models) to use a datastore-aware URL helper, and updates frontend uploaders + test coverage accordingly.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/models/concerns/folio/thumbnails_test.rb Adds coverage ensuring file-datastore thumbnail URLs are stored/returned without S3 rewriting.
test/lib/folio/s3/client_test.rb Updates presign-url expectations for local mode and adds traversal-rejection test.
test/dummy/config/application.rb Enables opting into :file datastore in local dev via FOLIO_DEV_LOCAL_FILES.
test/controllers/folio/api/s3_controller_test.rb Adds integration coverage for local upload/download endpoints and asserts headers/method returned by before.
lib/folio/env_flags.rb Documents the new FOLIO_DEV_LOCAL_FILES env flag.
lib/folio/engine.rb Adds new configuration defaults for datastore selection and local paths.
docs/configuration.md Documents new configuration options and boot-order requirement for datastore selection.
db/migrate/20231219123901_merge_folio_accounts_to_folio_users_and_drop_accounts_table.rb Refactors migration to use safer quoting and more SQL-based updates.
config/routes.rb Adds upload and download routes to the S3 API resource.
config/initializers/dragonfly.rb Switches Dragonfly datastore setup to a config-driven :file/:s3 case statement.
CHANGELOG.md Notes the new :file datastore support and thumbnail URL behavior.
app/models/folio/session_attachment/image.rb Uses datastore-aware Dragonfly URL helper for admin thumb URL generation.
app/models/concerns/folio/thumbnails.rb Uses datastore-aware URL helper for private thumbs and gates dev S3 fallback by actual datastore type.
app/lib/folio/s3/client.rb Implements tokenized local upload/download URL generation + safe local-path normalization, and streams IO uploads in local mode.
app/lib/folio/s3.rb Adds dragonfly_url_for plus datastore type helpers (file_datastore?, s3_datastore?).
app/jobs/folio/regenerate_thumb_webp_job.rb Uses datastore-aware URL helper for generated webp thumb URLs.
app/jobs/folio/migrate_thumbs_to_remote_url_job.rb Uses datastore-aware URL helper when rewriting stored thumb URLs.
app/jobs/folio/generate_thumbnail_job.rb Uses datastore-aware URL helper for stored thumb/webp URLs; gates dev S3 fallback by datastore type.
app/jobs/folio/generate_missing_thumb_webp_job.rb Uses datastore-aware URL helper for generated webp thumb URLs.
app/controllers/folio/api/s3_controller.rb Adds local direct upload/download actions with token verification and path checks.
app/components/folio/uppy_component.js Allows uploader to use server-provided method/headers (needed for local direct uploads).
app/assets/javascripts/folio/s3_upload.js Allows Dropzone uploader to use server-provided method/headers (needed for local direct uploads).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

mreq added 4 commits August 17, 2026 11:37
update_site_roles was writing available_user_roles from a stale pre-loop
snapshot, overwriting roles contributed by previously processed accounts.
Re-read the column per write so per-site roles accumulate across accounts.
Keep test uploads local after adding configurable Dragonfly storage.
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.

2 participants