Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes ICS download in non-public event content #6515

Merged
merged 3 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/volto/news/6515.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixes ICS download in non-public event content. @sneridagh
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/theme/Icon/Icon';
import { expandToBackendURL } from '@plone/volto/helpers/Url/Url';
import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';

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 packages/volto/src/express-middleware/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,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;
}
Loading