Skip to content

co-608: image fix#317

Open
manojSRawat wants to merge 2 commits into
Sunbird-coKreat:release-6.0.1from
manojSRawat:co-608
Open

co-608: image fix#317
manojSRawat wants to merge 2 commits into
Sunbird-coKreat:release-6.0.1from
manojSRawat:co-608

Conversation

@manojSRawat
Copy link
Copy Markdown
Contributor

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Type of change

Please choose appropriate options.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes in the below checkboxes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Ran Test A
  • Ran Test B

Test Configuration:

  • Software versions: Nodejs 8.11.2
  • Hardware versions:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

return (bufferImage = image.replace("data:image/jpg;base64,", ""));
} else if (image.includes("data:image/jpeg;base64")) {
return (bufferImage = image.replace("data:image/jpeg;base64,", ""));
} else if (image.includes("data:application/octet-stream;base64")) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@manojSRawat The application/octet-stream type is shown for documents when mimetype is unknown ( I have seen this when I have opened file in spreadsheets and word docs) ? (Correct me if I am wrong). So considering it as an image will be wrong.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I also face this kind of issue while uploading files on s3 without setting content-type.
@vaivk369 @vinukumar-vs could you please check if there is any change in upload functionality that might be related to this issue?

});
} else if (data.image) {
if (data.image.includes("data:image/")) {
if (data.image.includes("data:")) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why it was added & now why it is removed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

data:image is the actual way of finding the image or not. Why it is removed now. How are you identifying the data is image or not?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We are getting "application/octet-stream" in response header.
image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can add a check based on file extension but agian that's not a correct way because user can modify the file extension and upload it.

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.

3 participants