Skip to content

GitLab - Getting 404 (Not Found) for /assets/ace/mode-markdown.js

Created by: geordee

Getting the following error from GitLab while editing the code online.

GET http://git.server.local/assets/ace/mode-markdown.js 404 (Not Found) application-c8cd2dd87cbf8a023b21baf4d6996ac9.js:26
    t.loadScript application-c8cd2dd87cbf8a023b21baf4d6996ac9.js:26
    t.loadModule application-c8cd2dd87cbf8a023b21baf4d6996ac9.js:26
    setMode application-c8cd2dd87cbf8a023b21baf4d6996ac9.js:27
    (anonymous function)

It seems the asset is requested by the following Javascript that gets inline with the code.

Probably introduced in this commit https://github.com/gitlabhq/gitlabhq/commit/1794f606bd74ae775cd10a3f7da293fb67134c1c

# gitlab-ce.git/app/views/projects/edit_tree/show.html.haml

:javascript
  ace.config.set("modePath", gon.relative_url_root + "#{Gitlab::Application.config.assets.prefix}/ace")
  var ace_mode = "#{@blob.language.try(:ace_mode)}";
  var editor = ace.edit("editor");
  editor.setValue("#{escape_javascript(@blob.data)}");
  if (ace_mode) {
    editor.getSession().setMode('ace/mode/' + ace_mode);
  }

I wonder whether the inline Javascript knows anything about Rails asset management, and whether it is assuming that the file would be there in assets folder without hash and all.