Skip to content

Commit 3885a25

Browse files
committed
decode file content already figured out
1 parent e03cf63 commit 3885a25

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/components/file/helpers.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { decode } from 'base-64';
21
import {
32
get, updateContent, ensureContent, deleteContent, decodeBase64ToUtf8,
43
} from '../..';
@@ -17,15 +16,12 @@ export const ensureFile = async ({
1716
_message = message || `Created '${filepath}' using '${tokenid}'`;
1817
}
1918

20-
const _file = await ensureContent({
19+
const file = await ensureContent({
2120
config: _config, owner, repo, branch, filepath,
2221
content: defaultContent, message: _message, author,
2322
onOpenValidation,
2423
});
2524

26-
const content = _file.content && decode(_file.content);
27-
const file = {..._file, content};
28-
2925
return file;
3026
};
3127

src/components/file/useFile.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import useDeepCompareEffect from 'use-deep-compare-effect';
88
import { useDeepCompareCallback } from 'use-deep-compare';
99

1010
import {
11-
saveFile, ensureFile, deleteFile,
11+
saveFile, ensureFile, deleteFile, getContentFromFile,
1212
} from './helpers';
1313
import {
1414
FileCard, FileForm, useBlob,
@@ -91,8 +91,10 @@ function useFile({
9191
repository,
9292
onOpenValidation,
9393
});
94+
const content = await getContentFromFile(_file);
9495
update({
9596
..._file,
97+
content,
9698
branch,
9799
filepath: _file.path,
98100
});
@@ -210,8 +212,6 @@ function useFile({
210212
onConfirmClose,
211213
};
212214

213-
if (file?.content) debugger;
214-
215215
const components = {
216216
create: repository && (
217217
<FileForm

0 commit comments

Comments
 (0)