Conversation
# Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md
Contributor
There was a problem hiding this comment.
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 (
:s3vs: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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.