Commit 4c954a5c authored by Denys Mishunov's avatar Denys Mishunov

Mark images as binary on init

parent de6c2f70
...@@ -77,6 +77,7 @@ export const decorateFiles = ({ ...@@ -77,6 +77,7 @@ export const decorateFiles = ({
const fileFolder = parent && insertParent(parent); const fileFolder = parent && insertParent(parent);
if (name) { if (name) {
const previewMode = viewerInformationForPath(name);
parentPath = fileFolder && fileFolder.path; parentPath = fileFolder && fileFolder.path;
file = decorateData({ file = decorateData({
...@@ -92,9 +93,9 @@ export const decorateFiles = ({ ...@@ -92,9 +93,9 @@ export const decorateFiles = ({
changed: tempFile, changed: tempFile,
content, content,
base64, base64,
binary, binary: (previewMode && previewMode.binary) || binary,
rawPath, rawPath,
previewMode: viewerInformationForPath(name), previewMode,
parentPath, parentPath,
}); });
......
...@@ -3,6 +3,7 @@ import { __ } from '~/locale'; ...@@ -3,6 +3,7 @@ import { __ } from '~/locale';
const viewers = { const viewers = {
image: { image: {
id: 'image', id: 'image',
binary: true,
}, },
markdown: { markdown: {
id: 'markdown', id: 'markdown',
......
...@@ -12,6 +12,7 @@ const createEntries = paths => { ...@@ -12,6 +12,7 @@ const createEntries = paths => {
const { name, parent } = splitParent(path); const { name, parent } = splitParent(path);
const parentEntry = acc[parent]; const parentEntry = acc[parent];
const previewMode = viewerInformationForPath(name);
acc[path] = { acc[path] = {
...decorateData({ ...decorateData({
...@@ -22,7 +23,8 @@ const createEntries = paths => { ...@@ -22,7 +23,8 @@ const createEntries = paths => {
path, path,
url: createUrl(`/${TEST_PROJECT_ID}/${type}/${TEST_BRANCH_ID}/-/${escapeFileUrl(path)}`), url: createUrl(`/${TEST_PROJECT_ID}/${type}/${TEST_BRANCH_ID}/-/${escapeFileUrl(path)}`),
type, type,
previewMode: viewerInformationForPath(path), previewMode,
binary: (previewMode && previewMode.binary) || false,
parentPath: parent, parentPath: parent,
parentTreeUrl: parentEntry parentTreeUrl: parentEntry
? parentEntry.url ? parentEntry.url
......
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