Skip to content

Commit

Permalink
Fixes ICS download in non-public event content (#6497)
Browse files Browse the repository at this point in the history
  • Loading branch information
sneridagh authored Dec 7, 2024
1 parent bb2c18c commit b8d12f0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions news/6497.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixes ICS download in non-public event content. @sneridagh
4 changes: 2 additions & 2 deletions src/components/theme/EventDetails/EventDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
Recurrence,
} from '@plone/volto/components/theme/View/EventDatesInfo';
import { Icon } from '@plone/volto/components';
import { expandToBackendURL } from '@plone/volto/helpers';
import { flattenToAppURL } from '@plone/volto/helpers';

import calendarSVG from '@plone/volto/icons/calendar.svg';

Expand Down Expand Up @@ -147,7 +147,7 @@ const EventDetails = ({ content, display_as = 'aside' }) => {
className="ics-download"
target="_blank"
rel="noreferrer"
href={`${expandToBackendURL(content['@id'])}/ics_view`}
href={`${flattenToAppURL(content['@id'])}/ics_view`}
>
{intl.formatMessage(messages.downloadEvent)}
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ exports[`renders event details component with all props 1`] = `
/>
<a
className="ics-download"
href="http://localhost:8080/Plone/++api++/my-page/ics_view"
href="/my-page/ics_view"
rel="noreferrer"
target="_blank"
>
Expand Down Expand Up @@ -169,7 +169,7 @@ exports[`renders event details component with only required props 1`] = `
/>
<a
className="ics-download"
href="http://localhost:8080/Plone/++api++/my-page/ics_view"
href="/my-page/ics_view"
rel="noreferrer"
target="_blank"
>
Expand Down Expand Up @@ -211,7 +211,7 @@ exports[`renders event details component without links to api in the text 1`] =
/>
<a
className="ics-download"
href="http://localhost:8080/Plone/++api++/my-page/ics_view"
href="/my-page/ics_view"
rel="noreferrer"
target="_blank"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ exports[`renders an event view component with all props 1`] = `
/>
<a
className="ics-download"
href="http://localhost:8080/Plone/++api++/my-page/ics_view"
href="/my-page/ics_view"
rel="noreferrer"
target="_blank"
>
Expand Down Expand Up @@ -357,7 +357,7 @@ exports[`renders an event view component with only required props 1`] = `
/>
<a
className="ics-download"
href="http://localhost:8080/Plone/++api++/my-page/ics_view"
href="/my-page/ics_view"
rel="noreferrer"
target="_blank"
>
Expand Down Expand Up @@ -458,7 +458,7 @@ exports[`renders an event view component without links to api in the text 1`] =
/>
<a
className="ics-download"
href="http://localhost:8080/Plone/++api++/my-page/ics_view"
href="/my-page/ics_view"
rel="noreferrer"
target="_blank"
>
Expand Down
5 changes: 4 additions & 1 deletion src/express-middleware/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ function filesMiddlewareFn(req, res, next) {
export default function filesMiddleware() {
const middleware = express.Router();

middleware.all(['**/@@download/*', '**/@@display-file/*'], filesMiddlewareFn);
middleware.all(
['**/@@download/*', '**/@@display-file/*', '**/ics_view'],
filesMiddlewareFn,
);
middleware.id = 'filesResourcesProcessor';
return middleware;
}

0 comments on commit b8d12f0

Please sign in to comment.