@bestend/confluence-cli 1.15.4 → 1.15.5

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.
@@ -24,6 +24,12 @@ class ConfluenceClient {
24
24
  });
25
25
  }
26
26
 
27
+ sanitizeStorageContent(content) {
28
+ // Escape unescaped ampersands that would break XML (except already-escaped entities)
29
+ // This is a best-effort sanitizer; users should still provide valid XHTML when using --format storage.
30
+ return content.replace(/&(?![a-zA-Z]+;|#\d+;|#x[0-9a-fA-F]+;)/g, '&');
31
+ }
32
+
27
33
  sanitizeApiPath(rawPath) {
28
34
  const fallback = '/rest/api';
29
35
  const value = (rawPath || '').trim();
@@ -1356,6 +1362,10 @@ class ConfluenceClient {
1356
1362
  storageContent = content;
1357
1363
  }
1358
1364
 
1365
+ if (format === 'storage') {
1366
+ storageContent = this.sanitizeStorageContent(storageContent);
1367
+ }
1368
+
1359
1369
  const pageData = {
1360
1370
  type: 'page',
1361
1371
  title: title,
@@ -1387,6 +1397,10 @@ class ConfluenceClient {
1387
1397
  storageContent = content;
1388
1398
  }
1389
1399
 
1400
+ if (format === 'storage') {
1401
+ storageContent = this.sanitizeStorageContent(storageContent);
1402
+ }
1403
+
1390
1404
  const pageData = {
1391
1405
  type: 'page',
1392
1406
  title: title,
@@ -1433,6 +1447,10 @@ class ConfluenceClient {
1433
1447
  } else { // 'storage' format
1434
1448
  storageContent = content;
1435
1449
  }
1450
+
1451
+ if (format === 'storage') {
1452
+ storageContent = this.sanitizeStorageContent(storageContent);
1453
+ }
1436
1454
  } else {
1437
1455
  // If no new content, use the existing content
1438
1456
  storageContent = currentPage.data.body.storage.value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bestend/confluence-cli",
3
- "version": "1.15.4",
3
+ "version": "1.15.5",
4
4
  "description": "A command-line interface for Atlassian Confluence with page creation and editing capabilities",
5
5
  "main": "index.js",
6
6
  "bin": {