Skip to content

Commit

Permalink
README.md file viewer not displaying content according to file extens…
Browse files Browse the repository at this point in the history
…ion (#4380)
  • Loading branch information
eladlachmi authored Oct 18, 2022
1 parent 7c967e6 commit aef425e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions webui/src/pages/repositories/repository/objects.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -297,20 +297,22 @@ const TreeContainer = ({
}

const ReadmeContainer = ({repo, reference, path='', refreshDep=''}) => {
let readmePath = '';

if (path) {
readmePath = path.endsWith('/') ? `${path}${README_FILE_NAME}` : `${path}/${README_FILE_NAME}`;
} else {
readmePath = README_FILE_NAME;
}
const {response, error, loading} = useAPI(async () => {
if (path) {
path = path.endsWith('/') ? `${path}${README_FILE_NAME}` : `${path}/${README_FILE_NAME}`;
} else {
path = README_FILE_NAME;
}
return await objects.getWithHeaders(repo.id, reference.id, path);
return await objects.getWithHeaders(repo.id, reference.id, readmePath);
}, [path, refreshDep]);

if (loading || error) {
return <></>;
}

const fileExtension = getFileExtension(path);
const fileExtension = getFileExtension(readmePath);
const contentType = getContentType(response?.headers);

return (
Expand Down

0 comments on commit aef425e

Please sign in to comment.