Commit 00e7f328 authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett

Merge branch 'ide' of gitlab.com:gitlab-org/gitlab-ce into ide

parents 995a8ee2 b1f30151
......@@ -45,12 +45,12 @@ export default RepoFileButtons;
<template>
<div id="repo-file-buttons" v-if="isMini" :style="{'border-bottom': editableBorder}">
<a :href="rawFileURL" target="_blank" class="btn btn-default raw">{{rawDownloadButtonLabel}}</a>
<a :href="activeFile.raw_path" target="_blank" class="btn btn-default raw">{{rawDownloadButtonLabel}}</a>
<div class="btn-group" role="group" aria-label="File actions">
<a :href="blameFileURL" class="btn btn-default blame">Blame</a>
<a :href="historyFileURL" class="btn btn-default history">History</a>
<a href="#" class="btn btn-default permalink">Permalink</a>
<a :href="activeFile.blame_path" class="btn btn-default blame">Blame</a>
<a :href="activeFile.commits_path" class="btn btn-default history">History</a>
<a href="activeFile.permalink" class="btn btn-default permalink">Permalink</a>
</div>
<a href="#" v-if="canPreview" @click.prevent="rawPreviewToggle" class="btn btn-default preview">{{activeFileLabel}}</a>
......
......@@ -62,10 +62,6 @@ const RepoHelper = {
return file;
},
getRawURLFromBlobURL(url) {
return url.replace('blob', 'raw');
},
isKindaBinary() {
const okExts = ['md', 'svg'];
return okExts.indexOf(Store.activeFile.extension) > -1;
......@@ -79,8 +75,8 @@ const RepoHelper = {
return url.replace('blob', 'commits');
},
setBinaryDataAsBase64(url, file) {
Service.getBase64Content(url)
setBinaryDataAsBase64(file) {
Service.getBase64Content(file.raw_path)
.then((response) => {
Store.blobRaw = response;
file.base64 = response; // eslint-disable-line no-param-reassign
......@@ -163,6 +159,7 @@ const RepoHelper = {
if (data.binary) {
Store.binaryMimeType = data.mime_type;
// file might be undefined
RepoHelper.setBinaryDataAsBase64(data);
const rawUrl = RepoHelper.getRawURLFromBlobURL(file.url || Service.url);
RepoHelper.setBinaryDataAsBase64(rawUrl, data);
Store.setViewToPreview();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment