Ensure path of content loaded in the editor is consistent

pull/11/head
yann300 4 years ago committed by ioedeveloper
parent 501434e224
commit 65a786bf66
  1. 7
      apps/remix-ide/src/app/editor/editor.js

@ -324,6 +324,13 @@ class Editor extends Plugin {
* @param {string} content Content of the document or update.
*/
open (path, content) {
/*
we have the following cases:
- URL prepended with "localhost"
- URL prepended with "browser"
- URL not prepended with the file explorer. We assume (as it is in the whole app, that this is a "browser" URL
*/
if (!path.startsWith('localhost') && !path.startsWith('browser')) path = `browser/${path}`
if (!this.sessions[path]) {
const session = this._createSession(content, this._getMode(path))
this.sessions[path] = session

Loading…
Cancel
Save