-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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:handle render svg response #3833
base: main
Are you sure you want to change the base?
Conversation
}else if (contentType.includes('image')) { | ||
return 'application/image'; | ||
} | ||
else if (contentType.includes('xml')) { |
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.
@sahell0x Could you please adjust the formatting in this PR? Everything else looks great!
@@ -88,7 +88,6 @@ const QueryResult = ({ item, collection, data, dataBuffer, width, disableRunEven | |||
} else if (contentType.includes('video')) { | |||
allowedPreviewModes.unshift({ mode: 'preview-video', name: 'Video', uid: uuid() }); | |||
} | |||
|
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.
Can you revert this change as well
@@ -92,7 +92,10 @@ export const getContentType = (headers) => { | |||
return header[1]; | |||
}); | |||
if (contentType && contentType.length) { | |||
if (typeof contentType[0] == 'string' && /^[\w\-]+\/([\w\-]+\+)?json/.test(contentType[0])) { | |||
if (typeof contentType[0] === 'string' && /^image\/svg\+xml/i.test(contentType[0])) { | |||
return 'image/svg+xml'; |
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.
The formatting needs to be adjusted here as well.
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.
Sure naman.
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.
@naman-bruno latest commits are here please review .
This reverts commit e007227.
Description
issue ticket : #3781
i have added functionality to handle image/svg+xml contentType in getContentType function previously it is treating image/svg + xml as application/xml that is not allowing it to render on ui, now user can see image preview as well raw.
in getCodeMirrorModeBasedOnContentType i moved image condition to before the xml to handle both seamlessly .
Contribution Checklist:
Publishing to New Package Managers
Please see here for more information.