Skip to content
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

* Custom operations registered with `addCreateWidgetOperation` can now specify an `ifTypesIntersect` property containing an array of widget type names. If the area in question allows at least one, the operation is offered.

### Changes

* Redirects to URLs containing accent marks and other non-ascii characters now behave as expected with Astro. Pre-encoding the URLs exactly the way `res.redirect` would before passing them to Astro prevents an error in Astro and allows the redirect to succeed.

## 4.21.0 (2025-09-03)

### Adds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ export default {
return [];
}
const menu = [ ...this.contextMenuOptions.menu ];
const createWidgetOperations = filterCreateWidgetOperations(this.moduleOptions, this.options);
const createWidgetOperations = filterCreateWidgetOperations(
this.moduleOptions,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated lint

this.options
);
for (const createWidgetOperation of createWidgetOperations) {
menu.unshift({
type: 'operation',
Expand Down
7 changes: 6 additions & 1 deletion modules/@apostrophecms/express/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ const expressBearerToken = require('express-bearer-token');
const cors = require('cors');
const Promise = require('bluebird');
const expressCacheOnDemand = require('express-cache-on-demand');
const encodeUrl = require('encodeurl');

module.exports = {
async init(self) {
Expand Down Expand Up @@ -275,7 +276,11 @@ module.exports = {
// not us
// Per Express handling of 1 arg versus 2
const status = args.length > 1 ? args[0] : 302;
const url = args[args.length - 1];
let url = args[args.length - 1];
// The URL needs to be encoded exactly as Express would do it,
// so that frontends like Astro (which don't do it for us) don't bomb
// attempting to issue the redirect
url = encodeUrl(url);
return res.send({
redirect: true,
url,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"csv-parse": "^5.6.0",
"dayjs": "^1.9.8",
"dompurify": "^3.2.5",
"encodeurl": "^2.0.0",
"express": "^4.16.4",
"express-bearer-token": "^3.0.0",
"express-cache-on-demand": "^1.0.3",
Expand Down Expand Up @@ -143,4 +144,4 @@
"browserslist": [
"ie >= 10"
]
}
}