@adobe/aem-cli 16.15.6 → 16.15.7

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [16.15.7](https://github.com/adobe/helix-cli/compare/v16.15.6...v16.15.7) (2025-10-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * preserve logger this context in browser log forwarding ([#2608](https://github.com/adobe/helix-cli/issues/2608)) ([7e8f6bc](https://github.com/adobe/helix-cli/commit/7e8f6bcbd101af92cba3cacd6080013386ab09bf))
7
+
1
8
  ## [16.15.6](https://github.com/adobe/helix-cli/compare/v16.15.5...v16.15.6) (2025-09-30)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/aem-cli",
3
- "version": "16.15.6",
3
+ "version": "16.15.7",
4
4
  "description": "AEM CLI",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -188,11 +188,15 @@ export class HelixServer extends BaseServer {
188
188
  }
189
189
 
190
190
  // Build the HTML file path - only support .html extension
191
- const htmlFile = path.join(this._project.directory, this._htmlFolder, `${relativePath}.html`);
191
+ const htmlFile = path.resolve(this._project.directory, this._htmlFolder, `${relativePath}.html`);
192
192
 
193
193
  // Security check: ensure the file is within the project directory
194
- const relPath = path.relative(this._project.directory, htmlFile);
195
- if (relPath.startsWith('..') || path.isAbsolute(relPath)) {
194
+ // Use resolve to normalize both paths before comparing
195
+ const resolvedProjectDir = path.resolve(this._project.directory);
196
+ const relPath = path.relative(resolvedProjectDir, htmlFile);
197
+
198
+ // Only check for path traversal - remove the incorrect isAbsolute check
199
+ if (relPath.startsWith('..')) {
196
200
  return next();
197
201
  }
198
202
 
@@ -217,7 +221,10 @@ export class HelixServer extends BaseServer {
217
221
  }
218
222
 
219
223
  // Serve the file
220
- await sendFile(htmlFile, {
224
+ // Use the root option to specify the base directory for sendFile
225
+ // This prevents issues with worktrees in subdirectories
226
+ await sendFile(path.basename(htmlFile), {
227
+ root: path.dirname(htmlFile),
221
228
  dotfiles: 'deny',
222
229
  headers: {
223
230
  'access-control-allow-origin': '*',
@@ -100,9 +100,12 @@ class ClientConnection extends EventEmitter {
100
100
  }
101
101
  }).join(' ');
102
102
 
103
- // Use appropriate log level
104
- const logMethod = this.log[level] || this.log.info;
105
- logMethod(`${prefix} ${message}`);
103
+ // Use appropriate log level, preserving this context
104
+ if (this.log[level]) {
105
+ this.log[level](`${prefix} ${message}`);
106
+ } else {
107
+ this.log.info(`${prefix} ${message}`);
108
+ }
106
109
  }
107
110
 
108
111
  _send(data) {