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

fix(aws-provider): add https protocol when missing in file url #14654

Merged
merged 2 commits into from Oct 24, 2022

Conversation

nathan-pichon
Copy link
Member

What does it do?

Adding https:// to url that doesn't have any.
Also adding unit tests to this provider.

Why is it needed?

Digital Ocean only gives the URI without protocol in response to the upload.

How to test it?

The steps to reproduce are defined in the issue #14288

Steps to reproduce the behavior

  • Add an S3 provider to a Strapi project (AWS or community DO for example).
  • Connect to a DO spaces account
  • Add a video to the media library
  • Inspect the uploaded video with the browser dev tools and see the incorrect address.

Related issue(s)/PR(s)

Fix #14288

@strapi-cla
Copy link

strapi-cla commented Oct 18, 2022

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Oct 18, 2022

Codecov Report

Base: 58.75% // Head: 58.75% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (fde88d2) compared to base (df59099).
Patch coverage: 100.00% of modified lines in pull request are covered.

❗ Current head fde88d2 differs from pull request most recent head 0c9a4b7. Consider uploading reports for the commit 0c9a4b7 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14654   +/-   ##
=======================================
  Coverage   58.75%   58.75%           
=======================================
  Files        1322     1323    +1     
  Lines       32026    32041   +15     
  Branches     5968     5970    +2     
=======================================
+ Hits        18816    18826   +10     
- Misses      11349    11353    +4     
- Partials     1861     1862    +1     
Flag Coverage Δ
front 62.45% <ø> (-0.01%) ⬇️
unit 50.27% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/providers/upload-aws-s3/lib/index.js 66.66% <100.00%> (ø)
...-builder/admin/src/components/FormModal/reducer.js 94.02% <0.00%> (-0.34%) ⬇️
...ges/core/admin/admin/src/core/apis/CustomFields.js 100.00% <0.00%> (ø)
...s/core/strapi/lib/core/registries/custom-fields.js 100.00% <0.00%> (ø)
...pe-builder/admin/src/components/FormModal/index.js 0.00% <0.00%> (ø)
...uilder/admin/src/components/FormModal/constants.js 100.00% <0.00%> (ø)
...lewares/extendCTBAttributeInitialDataMiddleware.js 96.55% <0.00%> (+8.31%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@nathan-pichon nathan-pichon added pr: fix This PR is fixing a bug source: core:upload Source is core/upload package labels Oct 18, 2022
@nathan-pichon nathan-pichon marked this pull request as ready for review October 19, 2022 07:42
Adding hard coded https:// to url because Digital Ocean only gives the uri without protocol in response to the upload.

Fix #14288
Copy link
Contributor

@Marc-Roig Marc-Roig left a comment

Choose a reason for hiding this comment

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

Congratulations on your first PR! 🙂 Finally some tests for providers!

It looks good to me. I only will mention there are two other PRs that are modifying this file.url part.
#13040
#14477

Maybe in the future, we could think of a way to make this URL parsing more extendable.

@nathan-pichon nathan-pichon added this to the 4.4.5 milestone Oct 19, 2022
@Convly Convly modified the milestones: 4.4.5, 4.4.6 Oct 19, 2022
@strapi-bot
Copy link

This pull request has been mentioned on Strapi Community Forum. There might be relevant details there:

https://forum.strapi.io/t/video-preview-not-working-when-using-strapi-with-digitalocean-spaces/21716/4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: fix This PR is fixing a bug source: core:upload Source is core/upload package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

S3 providers are transposing the bucket and endpoint for video uploads
5 participants