Skip to content

Commit

Permalink
[File] removes force download when embedded
Browse files Browse the repository at this point in the history
  • Loading branch information
Elorfin committed Apr 11, 2023
1 parent 88bd4f2 commit d2e3916
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import {ContentComments} from '#/main/app/content/components/comments'
import {PlayerOverview} from '#/main/core/resources/file/player/components/overview'

const PlayerMain = (props) => {
// FIXME : ugly
if (constants.OPENING_DOWNLOAD === props.file.opening) {
if (!props.embedded && constants.OPENING_DOWNLOAD === props.file.opening) {
props.download(props.resourceNode)
} else if (constants.OPENING_BROWSER === props.file.opening) {
window.location.replace(url(['claro_resource_file_raw', {file: props.file.id}]))
Expand Down Expand Up @@ -59,9 +58,9 @@ const PlayerMain = (props) => {
)
}

props.download(props.resourceNode)

console.log(props.mimeType)
if (!props.embedded) {
props.download(props.resourceNode)
}

return (
<PlayerOverview
Expand All @@ -82,6 +81,7 @@ PlayerMain.propTypes = {
mimeType: T.string.isRequired,
download: T.func.isRequired,
resourceNode: T.shape(ResourceNodeType.propTypes).isRequired,
embedded: T.bool.isRequired,
canEdit: T.bool.isRequired,
file: T.shape(
FileTypes.propTypes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const PlayerMain = connect(
mimeType: selectors.mimeType(state),
file: selectors.file(state),
resourceNode: resourceSelectors.resourceNode(state),
embedded: resourceSelectors.embedded(state),
workspace: resourceSelectors.workspace(state),
canEdit: hasPermission('edit', resourceSelectors.resourceNode(state))
}),
Expand Down

0 comments on commit d2e3916

Please sign in to comment.