Skip to content

Commit

Permalink
[Console] Fix bug in which loading from a remote url fails when View …
Browse files Browse the repository at this point in the history
…in Console button is clicked in Elastic docs #144003

Co-authored-by: Muhammad Ibragimov <muhammad.ibragimov@elastic.co>
  • Loading branch information
mibragimov and Muhammad Ibragimov authored Oct 26, 2022
1 parent 2e03c3a commit b7c8011
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ function EditorUI({ initialTextValue, setEditorInstance }: EditorProps) {

const loadBufferFromRemote = (url: string) => {
const coreEditor = editor.getCoreEditor();
if (/^https?:\/\//.test(url)) {
// Normalize and encode the URL to avoid issues with spaces and other special characters.
const encodedUrl = new URL(url).toString();
if (/^https?:\/\//.test(encodedUrl)) {
const loadFrom: Record<string, any> = {
url,
// Having dataType here is required as it doesn't allow jQuery to `eval` content
Expand Down

0 comments on commit b7c8011

Please sign in to comment.