files.com 1.0.419 → 1.0.421

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.
Files changed (91) hide show
  1. package/_VERSION +1 -1
  2. package/lib/Api.js +2 -2
  3. package/lib/Files.js +1 -1
  4. package/lib/models/AccountLineItem.js +2 -2
  5. package/lib/models/Action.js +2 -2
  6. package/lib/models/ActionNotificationExport.js +2 -2
  7. package/lib/models/ActionNotificationExportResult.js +2 -2
  8. package/lib/models/ActionWebhookFailure.js +2 -2
  9. package/lib/models/ApiKey.js +2 -2
  10. package/lib/models/App.js +2 -2
  11. package/lib/models/As2IncomingMessage.js +2 -2
  12. package/lib/models/As2OutgoingMessage.js +2 -2
  13. package/lib/models/As2Partner.js +2 -2
  14. package/lib/models/As2Station.js +2 -2
  15. package/lib/models/Auto.js +2 -2
  16. package/lib/models/Automation.js +2 -2
  17. package/lib/models/AutomationRun.js +2 -2
  18. package/lib/models/BandwidthSnapshot.js +2 -2
  19. package/lib/models/Behavior.js +2 -2
  20. package/lib/models/Bundle.js +2 -2
  21. package/lib/models/BundleDownload.js +2 -2
  22. package/lib/models/BundleNotification.js +2 -2
  23. package/lib/models/BundleRecipient.js +2 -2
  24. package/lib/models/BundleRegistration.js +2 -2
  25. package/lib/models/Clickwrap.js +2 -2
  26. package/lib/models/DnsRecord.js +2 -2
  27. package/lib/models/EmailIncomingMessage.js +2 -2
  28. package/lib/models/Errors.js +2 -2
  29. package/lib/models/ExternalEvent.js +2 -2
  30. package/lib/models/File.js +2 -2
  31. package/lib/models/FileAction.js +2 -2
  32. package/lib/models/FileComment.js +2 -2
  33. package/lib/models/FileCommentReaction.js +2 -2
  34. package/lib/models/FileMigration.js +2 -2
  35. package/lib/models/FileUploadPart.js +2 -2
  36. package/lib/models/Folder.js +2 -2
  37. package/lib/models/FormField.js +2 -2
  38. package/lib/models/FormFieldSet.js +2 -2
  39. package/lib/models/GpgKey.js +2 -2
  40. package/lib/models/Group.js +2 -2
  41. package/lib/models/GroupUser.js +2 -2
  42. package/lib/models/History.js +2 -2
  43. package/lib/models/HistoryExport.js +2 -2
  44. package/lib/models/HistoryExportResult.js +2 -2
  45. package/lib/models/Image.js +2 -2
  46. package/lib/models/InboxRecipient.js +2 -2
  47. package/lib/models/InboxRegistration.js +2 -2
  48. package/lib/models/InboxUpload.js +2 -2
  49. package/lib/models/Invoice.js +2 -2
  50. package/lib/models/InvoiceLineItem.js +2 -2
  51. package/lib/models/IpAddress.js +2 -2
  52. package/lib/models/Lock.js +2 -2
  53. package/lib/models/Message.js +2 -2
  54. package/lib/models/MessageComment.js +2 -2
  55. package/lib/models/MessageCommentReaction.js +2 -2
  56. package/lib/models/MessageReaction.js +2 -2
  57. package/lib/models/Notification.js +2 -2
  58. package/lib/models/Payment.js +2 -2
  59. package/lib/models/PaymentLineItem.js +2 -2
  60. package/lib/models/Permission.js +2 -2
  61. package/lib/models/Preview.js +2 -2
  62. package/lib/models/Priority.js +2 -2
  63. package/lib/models/Project.js +2 -2
  64. package/lib/models/PublicIpAddress.js +2 -2
  65. package/lib/models/PublicKey.js +2 -2
  66. package/lib/models/RemoteBandwidthSnapshot.js +2 -2
  67. package/lib/models/RemoteServer.js +2 -2
  68. package/lib/models/RemoteServerConfigurationFile.js +2 -2
  69. package/lib/models/Request.js +2 -2
  70. package/lib/models/Session.js +2 -2
  71. package/lib/models/SettingsChange.js +2 -2
  72. package/lib/models/SftpHostKey.js +2 -2
  73. package/lib/models/ShareGroup.js +2 -2
  74. package/lib/models/ShareGroupMember.js +2 -2
  75. package/lib/models/Site.js +2 -2
  76. package/lib/models/Snapshot.js +2 -2
  77. package/lib/models/SsoStrategy.js +2 -2
  78. package/lib/models/Status.js +2 -2
  79. package/lib/models/Style.js +2 -2
  80. package/lib/models/UsageDailySnapshot.js +2 -2
  81. package/lib/models/UsageSnapshot.js +2 -2
  82. package/lib/models/User.js +2 -2
  83. package/lib/models/UserCipherUse.js +2 -2
  84. package/lib/models/UserRequest.js +2 -2
  85. package/lib/models/WebhookTest.js +2 -2
  86. package/lib/utils/pathNormalizer.js +5 -4
  87. package/lib/utils/pathNormalizer.test.js +18 -0
  88. package/package.json +1 -1
  89. package/src/Files.js +1 -1
  90. package/src/utils/pathNormalizer.js +7 -6
  91. package/src/utils/pathNormalizer.test.js +22 -0
@@ -198,7 +198,7 @@ var transliterate = function transliterate(str) {
198
198
  // converting the path to UTF-8 is not necessary in JS as it's the default
199
199
  var normalize = function normalize(path) {
200
200
  // Remove any characters with byte value of 0
201
- var cleaned = (path || '').replace(/\0/g, '');
201
+ var cleaned = (typeof path === 'string' ? path : '').replace(/\0/g, '');
202
202
 
203
203
  // Convert any backslash (\) characters to a forward slash (/)
204
204
  cleaned = cleaned.replace(/\\/g, '/');
@@ -239,13 +239,13 @@ var normalizeForComparison = function normalizeForComparison(path) {
239
239
  return normalized;
240
240
  };
241
241
  var same = function same(path1, path2) {
242
- return normalizeForComparison(path1) === normalizeForComparison(path2);
242
+ return typeof path1 === 'string' && typeof path2 === 'string' && normalizeForComparison(path1) === normalizeForComparison(path2);
243
243
  };
244
244
  var startsWith = function startsWith(path1, path2) {
245
- return normalizeForComparison(path1).startsWith(normalizeForComparison(path2));
245
+ return typeof path1 === 'string' && typeof path2 === 'string' && normalizeForComparison(path1).startsWith(normalizeForComparison(path2));
246
246
  };
247
247
  var keyLookup = function keyLookup(object, path) {
248
- var key = Object.keys(object).find(function (key) {
248
+ var key = Object.keys(object || {}).find(function (key) {
249
249
  return same(key, path);
250
250
  });
251
251
  return typeof key === 'string' ? object[key] : undefined;
@@ -253,6 +253,7 @@ var keyLookup = function keyLookup(object, path) {
253
253
  var pathNormalizer = {
254
254
  keyLookup: keyLookup,
255
255
  normalize: normalize,
256
+ normalizeForComparison: normalizeForComparison,
256
257
  same: same,
257
258
  startsWith: startsWith
258
259
  };
@@ -15,6 +15,24 @@ describe('pathNormalizer', function () {
15
15
  expect(_pathNormalizer.default.startsWith(input, startOfExpected)).toBe(true);
16
16
  });
17
17
  });
18
+ it('handles non-string params', function () {
19
+ expect(_pathNormalizer.default.normalize([])).toBe('');
20
+ expect(_pathNormalizer.default.normalize({})).toBe('');
21
+ expect(_pathNormalizer.default.normalize(null)).toBe('');
22
+ expect(_pathNormalizer.default.normalize(undefined)).toBe('');
23
+ expect(_pathNormalizer.default.same([], '')).toBe(false);
24
+ expect(_pathNormalizer.default.same(null, '')).toBe(false);
25
+ expect(_pathNormalizer.default.same([], null)).toBe(false);
26
+ expect(_pathNormalizer.default.same(undefined, undefined)).toBe(false);
27
+ expect(_pathNormalizer.default.startsWith(null, '')).toBe(false);
28
+ expect(_pathNormalizer.default.startsWith(null, [])).toBe(false);
29
+ expect(_pathNormalizer.default.startsWith([], null)).toBe(false);
30
+ expect(_pathNormalizer.default.startsWith(undefined, undefined)).toBe(false);
31
+ expect(_pathNormalizer.default.keyLookup(null, '')).toBe(undefined);
32
+ expect(_pathNormalizer.default.keyLookup(null, [])).toBe(undefined);
33
+ expect(_pathNormalizer.default.keyLookup([], null)).toBe(undefined);
34
+ expect(_pathNormalizer.default.keyLookup(undefined, undefined)).toBe(undefined);
35
+ });
18
36
  it('looks up keys in a map', function () {
19
37
  var map = {
20
38
  '': {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.0.419",
3
+ "version": "1.0.421",
4
4
  "description": "Files.com SDK for JavaScript",
5
5
  "keywords": [
6
6
  "files.com",
package/src/Files.js CHANGED
@@ -5,7 +5,7 @@ const endpointPrefix = '/api/rest/v1'
5
5
  let apiKey
6
6
  let baseUrl = 'https://app.files.com'
7
7
  let sessionId = null
8
- let version = "1.0.419"
8
+ let version = "1.0.421"
9
9
  let userAgent = `Files.com JavaScript SDK v${version}`
10
10
 
11
11
  let logLevel = LogLevel.INFO
@@ -193,7 +193,7 @@ const transliterate = str =>
193
193
  // converting the path to UTF-8 is not necessary in JS as it's the default
194
194
  const normalize = path => {
195
195
  // Remove any characters with byte value of 0
196
- let cleaned = (path || '').replace(/\0/g, '')
196
+ let cleaned = (typeof path === 'string' ? path : '').replace(/\0/g, '')
197
197
 
198
198
  // Convert any backslash (\) characters to a forward slash (/)
199
199
  cleaned = cleaned.replace(/\\/g, '/')
@@ -237,20 +237,21 @@ const normalizeForComparison = path => {
237
237
  return normalized
238
238
  }
239
239
 
240
- const same = (path1, path2) =>
241
- normalizeForComparison(path1) === normalizeForComparison(path2)
240
+ const same = (path1, path2) => typeof path1 === 'string' && typeof path2 === 'string'
241
+ && normalizeForComparison(path1) === normalizeForComparison(path2)
242
242
 
243
- const startsWith = (path1, path2) =>
244
- normalizeForComparison(path1).startsWith(normalizeForComparison(path2))
243
+ const startsWith = (path1, path2) => typeof path1 === 'string' && typeof path2 === 'string'
244
+ && normalizeForComparison(path1).startsWith(normalizeForComparison(path2))
245
245
 
246
246
  const keyLookup = (object, path) => {
247
- const key = Object.keys(object).find(key => same(key, path))
247
+ const key = Object.keys(object || {}).find(key => same(key, path))
248
248
  return typeof key === 'string' ? object[key] : undefined
249
249
  }
250
250
 
251
251
  const pathNormalizer = {
252
252
  keyLookup,
253
253
  normalize,
254
+ normalizeForComparison,
254
255
  same,
255
256
  startsWith,
256
257
  }
@@ -12,6 +12,28 @@ describe('pathNormalizer', () => {
12
12
  })
13
13
  })
14
14
 
15
+ it('handles non-string params', () => {
16
+ expect(pathNormalizer.normalize([])).toBe('')
17
+ expect(pathNormalizer.normalize({})).toBe('')
18
+ expect(pathNormalizer.normalize(null)).toBe('')
19
+ expect(pathNormalizer.normalize(undefined)).toBe('')
20
+
21
+ expect(pathNormalizer.same([], '')).toBe(false)
22
+ expect(pathNormalizer.same(null, '')).toBe(false)
23
+ expect(pathNormalizer.same([], null)).toBe(false)
24
+ expect(pathNormalizer.same(undefined, undefined)).toBe(false)
25
+
26
+ expect(pathNormalizer.startsWith(null, '')).toBe(false)
27
+ expect(pathNormalizer.startsWith(null, [])).toBe(false)
28
+ expect(pathNormalizer.startsWith([], null)).toBe(false)
29
+ expect(pathNormalizer.startsWith(undefined, undefined)).toBe(false)
30
+
31
+ expect(pathNormalizer.keyLookup(null, '')).toBe(undefined)
32
+ expect(pathNormalizer.keyLookup(null, [])).toBe(undefined)
33
+ expect(pathNormalizer.keyLookup([], null)).toBe(undefined)
34
+ expect(pathNormalizer.keyLookup(undefined, undefined)).toBe(undefined)
35
+ })
36
+
15
37
  it('looks up keys in a map', () => {
16
38
  const map = {
17
39
  '': { list: true },