n8n-nodes-onedrive-business 1.1.7 → 1.1.8

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.
@@ -31,6 +31,10 @@ export declare function resolveSubscriptionResource(location: DriveLocation): st
31
31
  * - Encodes special characters
32
32
  */
33
33
  export declare function sanitizePath(path: string): string;
34
+ /**
35
+ * Validate Microsoft Graph item ID format
36
+ */
37
+ export declare function isValidItemId(itemId: string): boolean;
34
38
  /**
35
39
  * Build the full item path for OneDrive API
36
40
  *
@@ -68,10 +72,6 @@ export declare function parseRetryAfter(retryAfterHeader?: string): number;
68
72
  * Used for clientState in webhook subscriptions
69
73
  */
70
74
  export declare function generateSecureRandomString(length?: number): string;
71
- /**
72
- * Validate Microsoft Graph item ID format
73
- */
74
- export declare function isValidItemId(itemId: string): boolean;
75
75
  /**
76
76
  * Check if an item is a file (vs folder)
77
77
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseGraphError = exports.cleanupProcessedVersions = exports.buildVersionKey = exports.getMimeType = exports.isFolder = exports.isFile = exports.isValidItemId = exports.generateSecureRandomString = exports.parseRetryAfter = exports.sleep = exports.calculateBackoffDelay = exports.formatBytes = exports.getFileExtension = exports.buildItemPath = exports.sanitizePath = exports.resolveSubscriptionResource = exports.resolveDrivePath = void 0;
3
+ exports.parseGraphError = exports.cleanupProcessedVersions = exports.buildVersionKey = exports.getMimeType = exports.isFolder = exports.isFile = exports.generateSecureRandomString = exports.parseRetryAfter = exports.sleep = exports.calculateBackoffDelay = exports.formatBytes = exports.getFileExtension = exports.buildItemPath = exports.isValidItemId = exports.sanitizePath = exports.resolveSubscriptionResource = exports.resolveDrivePath = void 0;
4
4
  /**
5
5
  * Helper Functions for OneDrive Business Node
6
6
  *
@@ -64,6 +64,22 @@ function sanitizePath(path) {
64
64
  return encodedParts.join('/');
65
65
  }
66
66
  exports.sanitizePath = sanitizePath;
67
+ /**
68
+ * Validate Microsoft Graph item ID format
69
+ */
70
+ function isValidItemId(itemId) {
71
+ if (!itemId || typeof itemId !== 'string') {
72
+ return false;
73
+ }
74
+ // Graph item IDs are base64-encoded strings but can vary.
75
+ // Use a heuristic: if it contains slash or colon, it's definitely a path.
76
+ // If it's a long string without path separators, treat as ID.
77
+ if (itemId.includes('/') || itemId.includes(':')) {
78
+ return false;
79
+ }
80
+ return true;
81
+ }
82
+ exports.isValidItemId = isValidItemId;
67
83
  /**
68
84
  * Build the full item path for OneDrive API
69
85
  *
@@ -76,9 +92,13 @@ function buildItemPath(drivePath, itemPath, itemId) {
76
92
  return `${drivePath}/items/${itemId}`;
77
93
  }
78
94
  if (itemPath) {
79
- // Strip standard Graph API prefixes if present
95
+ // Strip out duplicated drive root prefixes to fix "itemNotFound" errors
80
96
  // Matches: /drive/root:, drive/root:, /drives/{id}/root:, drives/{id}/root:
81
97
  let cleanPath = itemPath.replace(/^(\/)?(drive|drives\/[^\/]+)\/root:/i, '');
98
+ // Also remove any leading slash if present after replacement
99
+ if (cleanPath.startsWith('/')) {
100
+ cleanPath = cleanPath.substring(1);
101
+ }
82
102
  const sanitized = sanitizePath(cleanPath);
83
103
  if (sanitized) {
84
104
  return `${drivePath}/root:/${sanitized}`;
@@ -166,18 +186,6 @@ function generateSecureRandomString(length = 32) {
166
186
  return result;
167
187
  }
168
188
  exports.generateSecureRandomString = generateSecureRandomString;
169
- /**
170
- * Validate Microsoft Graph item ID format
171
- */
172
- function isValidItemId(itemId) {
173
- if (!itemId || typeof itemId !== 'string') {
174
- return false;
175
- }
176
- // Graph item IDs are typically base64-encoded strings
177
- // They should not contain spaces or special characters except !, _, -, and =
178
- return /^[A-Za-z0-9!_\-=]+$/.test(itemId);
179
- }
180
- exports.isValidItemId = isValidItemId;
181
189
  /**
182
190
  * Check if an item is a file (vs folder)
183
191
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-onedrive-business",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "n8n custom node for OneDrive Business with robust deduplication and webhook triggers",
5
5
  "keywords": [
6
6
  "n8n",