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] get file extension to check if it's allowed or not #30

Merged
merged 1 commit into from
Aug 8, 2022

Conversation

Alex01d
Copy link
Contributor

@Alex01d Alex01d commented Aug 8, 2022

Without extension files are always denied to upload.
Related to #26

@Baboo7
Copy link
Owner

Baboo7 commented Aug 8, 2022

@Alex01d from which url did you try to import the media? Files may need to be checked according to their mime type if there is no extension provided in the url

@Alex01d
Copy link
Contributor Author

Alex01d commented Aug 8, 2022

My URLs are like http://localhost/images.ctfassets.net/swpmepf0mrp6/Q902ryYwn8EBM71n9f3cF/0aa70a426a0730b99e1a024df99cd530/lomluda1972_cover.jpg (local copy) or https://images.ctfassets.net/swpmepf0mrp6/Q902ryYwn8EBM71n9f3cF/0aa70a426a0730b99e1a024df99cd530/lomluda1972_cover.jpg

But the problem is in isValidFileUrl: https://github.com/Baboo7/strapi-plugin-import-export-entries/blob/master/server/services/import/utils/file.js#L178 - here you get just { name } with no extension property, but then use extension in isExtensionAllowed(fileData.extension, allowedFileTypes) (line 181). It's always false.

Copy link
Owner

@Baboo7 Baboo7 left a comment

Choose a reason for hiding this comment

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

Good catch

@Baboo7 Baboo7 merged commit b68c663 into Baboo7:master Aug 8, 2022
@Baboo7
Copy link
Owner

Baboo7 commented Aug 8, 2022

New version 1.10.1 published

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.

None yet

2 participants