-
Notifications
You must be signed in to change notification settings - Fork 43
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
co-608: image fix #317
base: release-6.0.1
Are you sure you want to change the base?
co-608: image fix #317
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -471,7 +471,7 @@ function createSAObject(data, count) { | |
children: arr, | ||
}); | ||
} else if (data.image) { | ||
if (data.image.includes("data:image/")) { | ||
if (data.image.includes("data:")) { | ||
let image = getBufferImg(data.image); | ||
|
||
return new Paragraph({ | ||
|
@@ -551,6 +551,8 @@ function imageData(image) { | |
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")) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
return (bufferImage = image.replace("data:application/octet-stream;base64,", "")); | ||
} | ||
} | ||
|
||
|
@@ -795,7 +797,7 @@ function displayOptions(option, height, width) { | |
if (option !== undefined) { | ||
if (typeof option[1] === "object") { | ||
return displayOptionsObject(option[1]); | ||
} else if (option[1].includes("data:image/")) { | ||
} else if (option[1].includes("data:")) { | ||
let image = getBufferImg(option[1]); | ||
return new TableCell({ | ||
borders: MCQborder, | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.