n8n-nodes-onedrive-business 1.1.5 → 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.
|
@@ -253,8 +253,8 @@ class OneDriveBusiness {
|
|
|
253
253
|
},
|
|
254
254
|
default: '',
|
|
255
255
|
required: true,
|
|
256
|
-
placeholder: '/Documents/
|
|
257
|
-
description: '
|
|
256
|
+
placeholder: '/Documents/NewFolder/{{ $binary.data.fileName }}',
|
|
257
|
+
description: 'Full path of the file to save (e.g. /Documents/report.pdf). Tip: Use Expression to keep original name: /Path/To/Folder/{{ $binary.data.fileName }}',
|
|
258
258
|
},
|
|
259
259
|
{
|
|
260
260
|
displayName: 'Binary Property',
|
package/dist/utils/helpers.d.ts
CHANGED
|
@@ -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
|
*/
|
package/dist/utils/helpers.js
CHANGED
|
@@ -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.
|
|
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,7 +92,14 @@ function buildItemPath(drivePath, itemPath, itemId) {
|
|
|
76
92
|
return `${drivePath}/items/${itemId}`;
|
|
77
93
|
}
|
|
78
94
|
if (itemPath) {
|
|
79
|
-
|
|
95
|
+
// Strip out duplicated drive root prefixes to fix "itemNotFound" errors
|
|
96
|
+
// Matches: /drive/root:, drive/root:, /drives/{id}/root:, drives/{id}/root:
|
|
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
|
+
}
|
|
102
|
+
const sanitized = sanitizePath(cleanPath);
|
|
80
103
|
if (sanitized) {
|
|
81
104
|
return `${drivePath}/root:/${sanitized}`;
|
|
82
105
|
}
|
|
@@ -163,18 +186,6 @@ function generateSecureRandomString(length = 32) {
|
|
|
163
186
|
return result;
|
|
164
187
|
}
|
|
165
188
|
exports.generateSecureRandomString = generateSecureRandomString;
|
|
166
|
-
/**
|
|
167
|
-
* Validate Microsoft Graph item ID format
|
|
168
|
-
*/
|
|
169
|
-
function isValidItemId(itemId) {
|
|
170
|
-
if (!itemId || typeof itemId !== 'string') {
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
|
-
// Graph item IDs are typically base64-encoded strings
|
|
174
|
-
// They should not contain spaces or special characters except !, _, -, and =
|
|
175
|
-
return /^[A-Za-z0-9!_\-=]+$/.test(itemId);
|
|
176
|
-
}
|
|
177
|
-
exports.isValidItemId = isValidItemId;
|
|
178
189
|
/**
|
|
179
190
|
* Check if an item is a file (vs folder)
|
|
180
191
|
*/
|