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 replace media #7787

Merged
merged 2 commits into from Sep 9, 2020
Merged

Fix replace media #7787

merged 2 commits into from Sep 9, 2020

Conversation

soupette
Copy link
Contributor

@soupette soupette commented Sep 8, 2020

Signed-off-by: soupette cyril.lpz@gmail.com

Description of what you did:

This PR fixes #7776

Signed-off-by: soupette <cyril.lpz@gmail.com>
@soupette soupette added source: core:upload Source is core/upload package issue: bug Issue reporting a bug labels Sep 8, 2020
@soupette soupette requested review from HichamELBSI and petersg83 and removed request for alexandrebodin September 8, 2020 06:56
@codecov
Copy link

codecov bot commented Sep 8, 2020

Codecov Report

Merging #7787 into master will increase coverage by 0.03%.
The diff coverage is 58.82%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7787      +/-   ##
==========================================
+ Coverage   27.16%   27.20%   +0.03%     
==========================================
  Files        1163     1164       +1     
  Lines       15518    15519       +1     
  Branches     2410     2412       +2     
==========================================
+ Hits         4216     4222       +6     
+ Misses       9534     9528       -6     
- Partials     1768     1769       +1     
Flag Coverage Δ
#front 19.36% <62.50%> (+0.04%) ⬆️
#unit 53.85% <0.00%> (ø)

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

Impacted Files Coverage Δ
...admin/admin/src/components/ContainerFluid/index.js 66.66% <ø> (ø)
...in/src/components/LeftMenu/LeftMenuFooter/index.js 33.33% <0.00%> (-33.34%) ⬇️
...rc/containers/EditViewDataManagerProvider/index.js 0.00% <0.00%> (ø)
.../admin/src/components/ComponentIconPicker/index.js 0.00% <0.00%> (ø)
...agerProvider/utils/retrieveComponentsFromSchema.js 68.75% <ø> (ø)
...ugin-upload/admin/src/components/EditForm/index.js 0.00% <0.00%> (ø)
...rapi-plugin-upload/admin/src/translations/index.js 0.00% <ø> (ø)
packages/strapi-provider-upload-local/lib/index.js 29.16% <0.00%> (ø)
...ovider/utils/getFieldsActionMatchingPermissions.js 100.00% <100.00%> (ø)
...ditViewDataManagerProvider/utils/tests/testData.js 100.00% <100.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9461f20...5077b33. Read the comment docs.

Copy link
Contributor

@petersg83 petersg83 left a comment

Choose a reason for hiding this comment

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

Modifications look good to me :) I have a question/remark regarding a related code though


const createFileToDownloadName = ({ file, fileInfo: { name } }) => {
const ext = get(file, 'ext', '');

return `${name.replace(ext, '')}${ext}`;
Copy link
Contributor

@petersg83 petersg83 Sep 8, 2020

Choose a reason for hiding this comment

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

In case the extension is also present in the name (ex: my.txtfile.txt), I think this line would not do what expected.
What about:

return name.endsWith(ext)
  ? name
  : `${name}${ext}`;

Signed-off-by: soupette <cyril.lpz@gmail.com>
@petersg83 petersg83 self-requested a review September 9, 2020 08:07
Copy link
Contributor

@petersg83 petersg83 left a comment

Choose a reason for hiding this comment

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

LGTM !

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

Successfully merging this pull request may close these issues.

Media library breaks when replacing a media
3 participants