nodebb-plugin-composer-default 10.3.10 → 10.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/library.js CHANGED
@@ -103,8 +103,9 @@ plugin.filterComposerBuild = async function (hookData) {
103
103
 
104
104
  if (req.query.p) {
105
105
  try {
106
- const a = url.parse(req.query.p, true, true);
107
- return helpers.redirect(res, `/${(a.path || '').replace(/^\/*/, '')}`);
106
+ const a = new URL(req.query.p, 'http://localhost.com');
107
+ const path = (a.pathname + a.search).replace(/^\/+/, '');
108
+ return helpers.redirect(res, `/${path}`);
108
109
  } catch (e) {
109
110
  return helpers.redirect(res, '/');
110
111
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-composer-default",
3
- "version": "10.3.10",
3
+ "version": "10.3.11",
4
4
  "description": "Default composer for NodeBB",
5
5
  "main": "library.js",
6
6
  "repository": {
@@ -566,20 +566,23 @@ define('composer', [
566
566
  var returnPath = window.location.pathname.slice(1) + window.location.search;
567
567
 
568
568
  // Remove relative path from returnPath
569
- if (returnPath.startsWith(config.relative_path.slice(1))) {
570
- returnPath = returnPath.slice(config.relative_path.length);
569
+ if (config.relative_path && returnPath.startsWith(config.relative_path.slice(1))) {
570
+ returnPath = returnPath.slice(config.relative_path.length - 1);
571
+ if (returnPath.startsWith('/')) {
572
+ returnPath = returnPath.slice(1);
573
+ }
571
574
  }
572
575
 
573
576
  // Add in return path to be caught by ajaxify when post is completed, or if back is pressed
574
577
  window.history.replaceState({
575
578
  url: null,
576
579
  returnPath: returnPath,
577
- }, returnPath, config.relative_path + '/' + returnPath);
580
+ }, '', `${config.relative_path}/${returnPath}`);
578
581
 
579
582
  // Update address bar in case f5 is pressed
580
583
  window.history.pushState({
581
584
  url: path,
582
- }, path, `${config.relative_path}/${returnPath}`);
585
+ }, '', `${config.relative_path}/${returnPath}`);
583
586
  }
584
587
 
585
588
  function handleRemotePid(postContainer) {