                     # internal link
                     y.click (e) ->
                         target = $(@).attr('href')
+                        {join} = require('path')
                         if target.indexOf('/projects/') == 0
                             # fully absolute (but without https://...)
                             target = decodeURI(target.slice('/projects/'.length))

            file_path = @file_path()
            if misc.startswith(src, '/')
                file_path = ".smc/root/#{file_path}"
            new_src = "#{window.smc_base_url}/#{@project_id}/raw/#{file_path}/#{src}"
            y.attr('src', new_src)

    _post_save_success: () =>

                            target = decodeURI(target.slice(1))  # just get rid of leading slash
                        else if target[0] == '/'
                            # absolute inside of project
                            target = join(that.project_id, 'files', decodeURI(target))
                        else
                            # relative to current path
                            target = join(that.project_id, 'files', that.file_path(), decodeURI(target))
                        redux.getActions('projects').load_target(target, not(e.which==2 or (e.ctrlKey or e.metaKey)))
                        return false

