return props.href || props.kind === 'files'
? <a
style={{ textDecoration: 'none' }}
- href={props.kind === 'files' ? undefined : props.href}
+ href={props.kind === 'files' ? undefined : `${props.href}?disposition=attachment`}
onClick={props.onClick}
{...downloadProps}>
<ListItem button onClick={() => props.kind === 'files' ? createZip(props.href, props.download) : undefined}>
</ListItem>
</a>
: null;
-};
+};
\ No newline at end of file
import { getNodeValue } from "../../../models/tree";
import { ContextMenuKind } from '../context-menu';
import { filterCollectionFilesBySelection } from "~/store/collection-panel/collection-panel-files/collection-panel-files-state";
-import { sanitizeToken } from "./helpers";
const mapStateToProps = (state: RootState) => {
const { resource } = state.contextMenu;
const file = getNodeValue(resource.uuid)(state.collectionPanelFiles);
if (file) {
return {
- href: sanitizeToken(file.url, true),
+ href: file.url,
kind: 'file',
currentCollectionUuid
};
} else {
const files = filterCollectionFilesBySelection(state.collectionPanelFiles, true);
return {
- href: files.map(file => sanitizeToken(file.url, true)),
+ href: files.map(file => file.url),
kind: 'files',
currentCollectionUuid
};
// SPDX-License-Identifier: AGPL-3.0
import * as React from "react";
+import { connect } from 'react-redux';
import { ListItemIcon, ListItemText, ListItem } from "@material-ui/core";
import { OpenIcon } from "~/components/icon/icon";
import { sanitizeToken } from "./helpers";
+import { RootState } from "~/store/store";
-export const FileViewerAction = (props: { href?: any, download?: any, onClick?: () => void, kind?: string, currentCollectionUuid?: string; }) => {
+export const FileViewerAction = (props: any) => {
+ const {
+ keepWebServiceUrl,
+ keepWebInlineServiceUrl,
+ } = props;
return props.href
? <a
style={{ textDecoration: 'none' }}
- href={sanitizeToken(props.href, true)}
+ href={sanitizeToken(props.href.replace(keepWebServiceUrl, keepWebInlineServiceUrl), true)}
target="_blank"
onClick={props.onClick}>
<ListItem button>
</ListItemIcon>
<ListItemText>
Open in new tab
- </ListItemText>
+ </ListItemText>
</ListItem>
</a>
: null;
};
+
+const mapStateToProps = ({ auth }: RootState): any => ({
+ keepWebServiceUrl: auth.config.keepWebServiceUrl,
+ keepWebInlineServiceUrl: auth.config.keepWebInlineServiceUrl,
+});
+
+
+export default connect(mapStateToProps, null)(FileViewerAction);