Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge coming from upstream #2

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open

Merge coming from upstream #2

wants to merge 23 commits into from

Conversation

ShamoX
Copy link
Owner

@ShamoX ShamoX commented Jun 17, 2021

No description provided.

Roland Laurès and others added 23 commits October 10, 2019 16:34
first -shamox version
This plugin now fully supports rails 6, with updates such as :
- Raising `ActiveStorage::FileNotFoundError` when a key does not exist
- Updated method signatures to reflect the newest
`ActiveStorage::Service` interface

Additionally, with the new fog-openstack version, the filename can be
sent when requesting the object's URL.

Tests have been updated accordingly.
Remove unnecessary warning, as this gem now supports fog-openstack ~ 1.0  and rails 6
Rails 6.0.1 now aliases `create_after_upload` to `create_and_upload`
forcing the creation of the blob before uplaoding to the blob provider.
This causes a bug with this plugin since we add a after_commit hook
when a blob is created that updates the metadata(content type) of the
blob on the openstack provider assuming the blob had already
been uploaded beforehand.
An `ActiveStorage::FileNotFound` error is then raised because it tries
to update the metadata of a file that does not exist yet.

This hook is now totally removed. However for versions that are inferior
to rails 6.0.1, and starting from `5.2.1.1`, Rails has added native
support for a method called `update_metadata` that calls the service and
tries to update the blob in case it has not been identified yet.
To make this plugin work for all versions, the `update_metadata` method
has been implemetend replacing the current non standard method
"change_content_type".
Aliasing the old method to the newer one and deprecating the old method
won't work since the method signatures are not the same. Plus it was
used as a hack/non standard method workaround.

Misc changes:
- Rubocop cleanup + test updates.
- Content type is now only guessed if rails does not send it as a meta
parameter. However guessing content type inside the provider class is
unnecessary starting from version 5.2.1.1.
Will consider removing this altogether in a future release
- Update tests accordingly.
- Send Content-Disposition header in #upload definition if filename and
disposition are passed as params.
- Add support for rails 6.1
 - Add public/private url support ( Co-Authored with @jplot )
 - Add more test coverage for new API/behaviour
- Update `#url_for_direct_upload` to accept `filename:` as allowed by
  `fog-openstack` libray
- Add appraisal to handle multiple rails versions including rails master
  support
- Rubocop fixes
- Update README with rails 6.1 config examples
- Code cleaning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants