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:handle render svg response #3833

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sahell0x
Copy link

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 .

Screenshot from 2025-01-17 16-25-35

Contribution Checklist:

  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Publishing to New Package Managers

Please see here for more information.

@sreelakshmi-bruno sreelakshmi-bruno requested review from naman-bruno and removed request for sanjai0py January 25, 2025 07:39
}else if (contentType.includes('image')) {
return 'application/image';
}
else if (contentType.includes('xml')) {
Copy link
Contributor

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() });
}

Copy link
Contributor

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';
Copy link
Contributor

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.

Copy link
Author

Choose a reason for hiding this comment

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

Sure naman.

Copy link
Author

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants